Albert Johnston created SUREFIRE-1748:
-----------------------------------------
Summary: JUnit 5 Assertions.fail() breaks reporting
Key: SUREFIRE-1748
URL: https://issues.apache.org/jira/browse/SUREFIRE-1748
Project: Maven Surefire
Issue Type: Bug
Components: JUnit 5.x support, Maven Surefire Plugin
Affects Versions: 3.0.0-M4
Reporter: Albert Johnston
Associated versions on my end at time of testing:
* JUnit Jupiter 5.3.2
* JDK 1.8u172
* Maven 3.6.3
Demonstration available at
[https://github.com/ajohnstonTE/surefire-jira-examples/tree/master/junit-assertions-fail]
If the following JUnit 5 code is run through Surefire, then the reporting
breaks for that class, resulting in no reported errors/failures from that class
(though any failures will still be reported overall in the counts):
public class JUnit5Test {
@Test
void failWithNoParameters() {
Assertions.fail();
}
}
Resulting output:
{noformat}
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.016 s
<<< FAILURE! - in JUnit5Test
[ERROR] JUnit5Test.failWithNoParameters Time elapsed: 0.008 s <<< FAILURE!
[ERROR] Failures:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test) on
project junit-assertions-fail: Execution default-test of goal
org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test failed.:
NullPointerException -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace...{noformat}
And with the -e flag, trimmed to the relevant part:
{noformat}
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.016 s
<<< FAILURE! - in JUnit5Test
[ERROR] JUnit5Test.failWithNoParameters Time elapsed: 0.007 s <<< FAILURE!
[ERROR] Failures:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test) on
project junit-assertions-fail: Execution default-test of goal
org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test failed.:
NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test) on
project junit-assertions-fail: Execution default-test of goal
org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test failed.
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution
default-test of goal
org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test failed.
Caused by: java.lang.NullPointerException
at
org.apache.maven.plugin.surefire.report.DefaultReporterFactory.printTestFailures
(DefaultReporterFactory.java:398)
at
org.apache.maven.plugin.surefire.report.DefaultReporterFactory.runCompleted
(DefaultReporterFactory.java:198)
at org.apache.maven.plugin.surefire.report.DefaultReporterFactory.close
(DefaultReporterFactory.java:171)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run
(ForkStarter.java:254)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider
(AbstractSurefireMojo.java:1217)
at
org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked
(AbstractSurefireMojo.java:1063)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute
(AbstractSurefireMojo.java:889){noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)