I'm trying to skip particular tests based on some condition using annotation transformers http://ift.tt/1PjlaUv
Here is my class
public class MyDisabledTest implements IAnnotationTransformer {
@Test(enabled=false)
public void testDisabled() {
System.out.println("This is a disabled test");
}
@Override
public void transform(ITestAnnotation annotation, Class testClass,
Constructor testConstructor, Method testMethod) {
// TODO Auto-generated method stub
if ("testDisabled".equals(testMethod.getName())) {
annotation.setEnabled(true);
}
}
}
Here's my xml
<suite name="MyTestNGSuite" parallel="methods"
data-provider-thread-count="3" thread-count="3">
<listeners>
<listener class-name="com.walmart.gls.demo_package.MyDisabledTest"/>
</listeners>
<test name="MyTestNGTest">
<classes>
<class name="MyDisabledTest">
<methods>
<include name="testDisabled" />
</methods>
</class>
</classes>
</test>
</suite>
I'm trying to enable the test which has been disabled at compile time. What am I getting wrong here? I'm not getting anything printed on console.
Aucun commentaire:
Enregistrer un commentaire