TeamCity 9.1 supports NUnit 3 and opens up many other possibilities to select tests to run or filter them. I would recommend using --where=EXPRESSION , which allows you to use Test Selection Language . Now you can even use regular expressions to indicate which tests you want to run or exclude.
<strong> Examples
Do you want to exclude only one test?
--where="method != 'TestName'"
Do you want to exclude only one test? Do not remember the name exactly, but something with "BuggyMethod" ( ~ means that the regular expression is involved):
--where="method !~ 'BuggyMethod'"
Run all tests defined in one class:
--where="class == 'My.Namespace.ClassName'"
Forget the full namespace? This is no longer a problem - use regex:
--where="class =~ 'ClassName'"
You can also combine these expressions to achieve the desired effect. Run all tests for the class, but exclude all methods that contain "BuggyMethod":
--where="class =~ 'ClassName' and method !~ 'BuggyMethod'"
This approach is much more flexible and avoids any modifications to your code. I no longer see the point of using categories if your tests are not categorized.
source share