سؤال

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