You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Versions of lib
.NET 6, NUnit 4.1.0 with NUnit3TestAdapter 4.5.0 and Microsoft.NET.Test.Sdk 17.9.0.
Command to execute tests dotnet test "testingnunit.dll" --verbosity d --filter "(TestCategory=TestsA&TestCategory!=TestsB)|(TestCategory=TestsC)"
How to reproduce
Create a project called testingnunit with the provided example class in it. Build the project.
Run the test command, no tests will be found when running with NUnit version 4.0.0 or later.
Output is "No test matches the given testcase filter".
If you downgrade NUnit to version 3.14.0 and run the test command it finds the tests. TestInA and TestInC are exectued, TestInB is excluded as expected.
How to mitigate the problem when running with NUnit 4.1.0
Run dotnet test for each filter within parentheses.
First run dotnet test "testingnunit.dll" --verbosity d --filter "(TestCategory=TestsA&TestCategory!=TestsB)", and then run dotnet test "testingnunit.dll" --verbosity d --filter "(TestCategory=TestsC)"
The above is a problem if you have a project with many test categories and want to create complex filters.
In my case I want to execute all tests that are not ignored for a module, except the ones that are categorized as slow/obtrusive, and I also want to include not ignored cross-module "smoketests".
My test filter that works in NUnit 3.14.0 but fails to find any tests in NUnit 4.1.0
(TestCategory=MyModule&TestCategory!=Obtrusive&TestCategory!=Slow&TestCategory!=Ignored)|(TestCategory=Smoketest&TestCategory!=Ignored)
Thanks! So with 3.14.0 and adapter 4.5.0 it works, but with 4.1.0 and adapter 4.5.0 it doesn't work?
Exactly.
cjohnsson
changed the title
After upgrade from version 3.14.0 to 4.* separating multiple testcategories inside parentheses with 'OR' stopped working
After upgrade from version 3.14.0 to 4.* running multiple test categories in parentheses separated with 'OR' stopped working
Mar 4, 2024
Versions of lib
.NET 6, NUnit 4.1.0 with NUnit3TestAdapter 4.5.0 and Microsoft.NET.Test.Sdk 17.9.0.
Command to execute tests
dotnet test "testingnunit.dll" --verbosity d --filter "(TestCategory=TestsA&TestCategory!=TestsB)|(TestCategory=TestsC)"
How to reproduce
Output is "No test matches the given testcase filter".
How to mitigate the problem when running with NUnit 4.1.0
Run dotnet test for each filter within parentheses.
First run
dotnet test "testingnunit.dll" --verbosity d --filter "(TestCategory=TestsA&TestCategory!=TestsB)"
, and then rundotnet test "testingnunit.dll" --verbosity d --filter "(TestCategory=TestsC)"
Code example
The text was updated successfully, but these errors were encountered: