formulahendry/vscode-dotnet-test-explorer

Not possible to execute tests with parameterized TestFixtures

開放

#144 建立於 2018年9月12日

 (10 則留言) (0 個反應) (0 位負責人)TypeScript (94 個分叉)github user discovery
enhancementhelp wanted

倉庫指標

星標
 (210 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Description

When trying to run a test case which has a Parameterized TestFixture the executions fails due to not finding the test case. The reason is that the FQN used is missing the parameters. This is the current output I get for the example below.

Executing dotnet test --logger "trx;LogFileName=/tmp/test-explorer/0.trx" --filter FullyQualifiedName~example.ExampleTests.Test_Example in ...
Build started, please wait...
Build completed.

Test run for .../example.dll(.NETCoreApp,Version=v2.0)
Microsoft (R) Test Execution Command Line Tool Version 15.3.0-preview-20170628-02
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
NUnit Adapter 3.10.0.21: Test execution started
Running all tests in .../example.dll
NUnit3TestExecutor converted 1 of 1 NUnit test cases
Skipping assembly - no matching test cases found
NUnit Adapter 3.10.0.21: Test execution complete
No test matches the given testcase filter `FullyQualifiedName~example.ExampleTests.Test_Example` in .../example.dll

Solution

This is possible to execute on the command line using this filter:

dotnet test --logger "trx;LogFileName=/tmp/output.trx" --filter '"FullyQualifiedName~example.ExampleTests\(\"First\"\).Test_Example"'

Example

namepace example {
    [TestFixture("First")]
    [TestFixture("Second")]
    public class ExampleTests
    {
        public ExampleTests(string arg)
        {
            // Do something with arg that affects the tests
        }

        [TestCase]
        public void Test_Example()
        {
            // Test something
        }
    }
}

貢獻者指南