You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a TestNG test class has only non-public @Test methods, an attempt to discover tests for that class will find zero tests when the TestNGTestEngine is discovering tests from classes scanned from the classpath.
Changing at least one of the @Test methods to public allows all tests in the class to be detected.
Thus, org.junit.support.testng.engine.IsTestNGTestClass needs to be revised to use candidateClass.getDeclaredMethods() instead of candidateClass.getMethods(), and it will then also need to manually traverse up the type hierarchy in search of @Test methods.
The text was updated successfully, but these errors were encountered:
This commit makes all test methods in our TestNG test classes public
due to the following bug in the TestNG engine for the JUnit Platform.
junit-team/testng-engine#16
See gh-27407
Maybe org.junit.platform.commons.support.AnnotationSupport.findAnnotatedMethods(Class<?>, Class<? extends Annotation>, HierarchyTraversalMode) could be used.
Or does that search algorithm do too much with regard to TestNG's standard algorithm?
Thanks to a bug fix in 1.0.5, test methods in TestNG test classes can
finally be package private as was always the case with TestNG itself.
See junit-team/testng-engine#16
If a TestNG test class has only non-public
@Test
methods, an attempt to discover tests for that class will find zero tests when theTestNGTestEngine
is discovering tests from classes scanned from the classpath.Changing at least one of the
@Test
methods topublic
allows all tests in the class to be detected.Thus,
org.junit.support.testng.engine.IsTestNGTestClass
needs to be revised to usecandidateClass.getDeclaredMethods()
instead ofcandidateClass.getMethods()
, and it will then also need to manually traverse up the type hierarchy in search of@Test
methods.The text was updated successfully, but these errors were encountered: