New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test methods references not passed correctly with @Test class #190
Comments
@EugeneAbramchuk |
Hi @missedone |
do you think it's an issue of testng? here is the testng.xml I created for running the test @EugeneAbramchuk provided: <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Default suite">
<listeners>
<listener class-name="com.testngissue.util.DefaultListener" />
</listeners>
<test verbose="10" name="Default test">
<classes>
<class name="com.testngissue.tests.SampleTests" />
</classes>
</test>
</suite> and here is the output:
the |
I didn't check yet but I suppose |
@EugeneAbramchuk, |
@missedone @juherr Hi guys, In my framework I have more complex annotations and I am afraid I need more control over the test, so
I have done just that, but in reality it does not behave this way, therefore I'd suggest an issue with testNG or documentation mistake. I have already looked briefly into the source but could not pinpoint issue so far. |
doesn't means "public methods will have virtual @test annotation". I understand your usecase but it won't be easy to add. I propose to close this issue and open an new one on the TestNG project: https://github.com/cbeust/testng/issues |
Point accepted, I will try to think of a solution. |
Hi guys,
I have a class annotated with @test with several public methods meant to be tests. I also have a custom annotation on each public method to be used internally to deduce if this method needs to be skipped.
My problem is, when I execute the whole class,
org.testng.internal.annotations.JDK15AnnotationFinder#transform passes to my annotation implementation a null test method object for each public method without a @test annotation. If I annotate several methods with @test, they will be detected correctly.
A snippet to illustrate a concept:
@test
public class FooBar {
@test
@MyAnnotation(params)
public void foo() {
// org.testng.internal.annotations.JDK15AnnotationFinder#transform
// private void transform(IAnnotation a, Class testClass, Constructor testConstructor, Method testMethod)
// will have foo as a testMethod
}
@MyAnnotation(params)
public void bar() {
// org.testng.internal.annotations.JDK15AnnotationFinder#transform
// private void transform(IAnnotation a, Class testClass, Constructor testConstructor, Method testMethod)
// will have null as a testMethod
}
}
If I remove @test from the class name and just annotate each method, every method reference is passed as expected. But maybe there is a more inventive way?
My testNG version is 6.8.7
The text was updated successfully, but these errors were encountered: