Programmatically skip an nunit test

前端 未结 2 1238
没有蜡笔的小新
没有蜡笔的小新 2020-12-10 00:38

Is there a way for an nunit test to end and tell the test runner that it should be considered skipped/ignored, rather than succeeded or failed?

My motivation for thi

2条回答
  •  伪装坚强ぢ
    2020-12-10 01:23

    I am having a TestInit(), TestInitialize method where there is a condition like:

        //This flag is the most important.False means we want to just ignore that tests
        if (!RunFullTests)
            Assert.Inconclusive();
    

    RunFullTests is a global Boolean variable located in a constant class. If we set this to false the whole test class will be ignored and all the tests under this class will be ignored.

    I use this when there are integration tests.

提交回复
热议问题