Open rtandy opened 3 years ago
@Tibor17 The origin of the NPE is a JUnit warning because there are no tests in the class. Adding a test will produce a JUnit reflection issue later. Both will be fixed on the TestNG side.
But why not excluding abstract classes by default when classes are scanned?
TestNG Version
6.9.13 and later, including 7.3.0 (6.9.10 works, .11 and .12 are not available on Maven for some reason, so I did not test them)
Actual behavior
When the test suite contains both an abstract JUnit 3.8 TestCase with no public test methods AND a concrete JUnit 4 or TestNG test class with test methods, a "Failure in JUnit mode" is reported, but the build does not fail.
(The codebase I'm working in uses TestNG mostly, but there are a few old test classes remaining that are still based on a custom subclass of GroovyTestCase which in turn extends TestCase.)
Workarounds: rename the abstract class so Surefire doesn't detect it as a test class, or add an empty public test method to it.
Note that the failure did not actually cause the build to fail (might be a duplicate of #311).
Test case sample
pom.xml
src/test/java/com/example/AbstractJUnit38TestCase.java
src/test/java/com/example/ExampleTestNGTest.java