开发者

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

开发者 https://www.devze.com 2023-01-05 01:05 出处:网络
For example, a test case named ExampleTest ExampleTe开发者_如何转开发st { testA{}; testB{}; testC();

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

精彩评论

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