【发布时间】:2014-09-10 03:01:28
【问题描述】:
如何在 testNG 中使用 IAnnotationTransformer? 当我调试时,代码从未进入转换函数。它执行了所有 3 个测试。我使用 Maven 来触发我的测试,这就是我所拥有的--
public class SomeTest {
@BeforeClass
public void before(){
TestNG testNG = new TestNG();
testNG.setAnnotationTransformer(new Transformer());
}
@Test(priority = 1)
public void test1(){}
@Test(priority = 2)
public void test2(){}
@Test(priority = 3)
public void test3(){}
}
public class Transformer implements IAnnotationTransformer {
public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod){
if (true){
annotation.setEnabled(false);
}
}
}
【问题讨论】:
标签: java selenium annotations testng