2010-06-24 87 views
0

例如,测试案例命名ExampleTest有谁知道如何在测试套件中运行的测试用例中选择部分测试方法?

ExampleTest { 
    testA{}; 
    testB{}; 
    testC(); 
} 

我可以运行所有这些类TestSuite.addTestSuite(ExampleTest.class);

但是,如何选择testAtestB碰上TestSuite

+0

参见http://stackoverflow.com/questions/1368915/exclude-individual-junit-test-methods-without-modifying-the-test-class – 2010-06-24 03:32:51

+0

你就不能标注TESTC被忽略? – 2010-06-24 06:20:48

回答

2

2想法:

  • 看它是否有道理根据你的分区
  • 否则使用类别来标记你的测试ExampleTest分裂成2个测试类然后运行测试属于到特定类别。它在NUnit中更简单,JUnit似乎要求您创建一个空的/标记接口来完成此操作。 A sample link with code
+0

+1类别,但它看起来问题是针对JUnit 3 – topchef 2010-06-26 06:14:36

相关问题