formulahendry/vscode-dotnet-test-explorer
View on GitHubNot possible to execute tests with parameterized TestFixtures
Open
#144 opened on Sep 12, 2018
enhancementhelp wanted
Repository metrics
- Stars
- (210 stars)
- PR merge metrics
- (PR metrics pending)
Description
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
}
}
}