有没有办法以编程方式为@Test 设置“启用”属性?
类似于在 @BeforeClass 中定义一个布尔变量并通过启用检查它?
用例是这样的:同一个测试器测试了几个类,但不是所有的类都实现了所有的方法,所以不应该跳过缺失的方法。
测试仪将类似于
public abstract class MegaTester {
@Test
public void test1() {
...
}
@Test
public void test2() {
...
}
@Test
public void test3() {
...
}
}
public class ATest extends MegaTester {
@Test
public void test1() {
// my own implementation of test1
}
// test2 from MegaTester will be called here
// I don't implement test3, but how do I indicate I don't want it ran from MegaTester?
}
谢谢