有没有一种方法来以编程方式为@Test设置“启用”属性?以编程方式“启用”TestNG方法
就像在@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?
}
感谢
这就是我所需要的。谢谢! – user1293962