开发者

Does anyone know how to select parts of test methods in a test case run in a test suite?

For example, a test case named ExampleTest

ExampleTe开发者_如何转开发st {
    testA{};
    testB{};
    testC();
}

I could run all this class with TestSuite.addTestSuite(ExampleTest.class);

but, how to select testA and testB run into TestSuite?


2 Ideas:

  • See if it makes sense to split ExampleTest into 2 test classes based on your partition
  • Otherwise use Categories to tag your tests and then run tests which belong to a specific category. Its simpler in NUnit, JUnit seems to require you to create an empty/ marker interface to get this done. A sample link with code.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜