IAnnotationTransformer doesn't run when specified as an @Listeners
See original GitHub issueIAnnotationTransformer only works when specified in the suite xml file with <listeners>. I would like it to also run the transformer when specified in the @Listener annotation
Example:
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import org.testng.IAnnotationTransformer;
import org.testng.annotations.ITestAnnotation;
public class TransformerImpl implements IAnnotationTransformer {
@Override
public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) {
System.out.println("Transform Annotation");
}
}
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
@Listeners({ TransformerImpl.class })
public class AnnotationTest {
@Test
public void run() {
System.out.println("run");
}
}
Issue Analytics
- State:
- Created 10 years ago
- Comments:7
Top Results From Across the Web
java - overridden transform method of IAnnotationTransformer ...
I used testng.xml to use listeners but invocation count is not changing ... Method; public class Listeners implements IAnnotationTransformer ...
Read more >Exploring TestNG Listeners for controlled Execution - LinkedIn
IAnnotationTransformer works, only when specified in testng suite xml file and will not work when specified in the @Listeners annotation. The @ ...
Read more >Use IAnnotationTransformer to disable testcases
I have written an AnnotationTransformer to disable certain tests. import java.lang.reflect.Constructor; import java.lang.reflect.Method; import org.
Read more >Test methods, classes and groups - TestNG Docs
Groups are specified in your testng.xml file and can be found either under ... your test methods are run in a certain order...
Read more >TestNG (TestNG 6.8.17 API) - Javadoc.io
void, setUseDefaultListeners(boolean useDefaultListeners) If this method is passed true before run(), the default listeners will not be used.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
From the documentation: (http://testng.org/doc/documentation-main.html)
@ChenaLee - Not true to the best of my knowledge. I think the javadocs makes this explicit.