简体   繁体   中英

Nunit - How to skip test setup to call for particular unit test case

I have unittest case project where TestSetup is globally setup for all test files.

[SetUpFixture]
public class TestSetup
{
     [Setup]
     public TestSetupMethod(){}
}

How to skip test setup to call for particular nunit unit test case. all other unit test case need this but for couple of unit test case where it is not require.

From the documentation :

This is the attribute that marks a class that contains the one-time setup or teardown methods for all the test fixtures under a given namespace.

So simply add all unit tests that requires the one-time setup in the namespace of your setup class, all that don't require that setup in another.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM