문제

Are there a way that one can ignore unit tests when running NUnit from the command line based on a wildcard?

Say for example I don't want to run any tests that end with IntegrationTest? In that case I would like to say ignore all tests containing *IntegrationTest*

도움이 되었습니까?

해결책

Unfortunately, NUnit does not support the use of wildcards for specifying which tests should or not be executed. As you're using NUnit 2.5.9, you have a few other options for doing something similar:

  • Tag your integration tests fixtures with a specific category, such as:
[Category("Integration")]
    [TestFixture]
    public class MyTests {  }

and use the following command to run your tests:

nunit-console myassembly.dll /exclude:Integration

  • Separate your integration tests in different assemblies and use the command below:

nunit-console nunit.tests.integration.dll

If you upgrade your version to NUnit 2.6.2, you can also use a separate list of tests in a text file, and run them using

nunit-console /runlist:testlist.txt nunit.tests.dll

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top