[ 
https://issues.apache.org/jira/browse/SUREFIRE-1688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16937436#comment-16937436
 ] 

Guy Brand commented on SUREFIRE-1688:
-------------------------------------

With a newer snapshot after the one I tested while reporting the issue was not 
present anymore. Could you close it as explained? Thanks.

> Junit Platform test with failing @BeforeAll does not fail the build
> -------------------------------------------------------------------
>
>                 Key: SUREFIRE-1688
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1688
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: JUnit 5.x support, Maven Surefire Plugin
>            Reporter: Guy Brand
>            Priority: Major
>
> When using Surefire {{3.0.0-SNAPSHOT}} and JUnit Platform {{5.4.2}} the 
> following test does not fail the Maven build. 
> {code:java}
> import org.junit.jupiter.api.Test;
> import org.junit.jupiter.api.BeforeAll;
> import org.junit.jupiter.api.Assertions;
> public class Tests {
>     @BeforeAll
>     public static void beforeAll() { Assertions.fail("BeforeAll fail"); }
>     @Test
>     public void test() { Assertions.fail("Test fail"); }
> }
> {code}
> And its output:
> {code}
> [INFO] --- maven-surefire-plugin:3.0.0-SNAPSHOT:test (default-test) @ 
> top-level-project ---
> [INFO] 
> [INFO] -------------------------------------------------------
> [INFO]  T E S T S
> [INFO] -------------------------------------------------------
> [INFO] Running Tests
> [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 
> s - in Tests
> [INFO] 
> [INFO] Results:
> [INFO] 
> [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
> [INFO] 
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> {code}
> When removing the {{@BeforeAll}} annotation/method it fails as expected. 
> {{3.0.0-M3}} version of Surefire works as expected:
> {code}
> [INFO] --- maven-surefire-plugin:3.0.0-M3:test (default-test) @ 
> top-level-project ---
> [INFO] 
> [INFO] -------------------------------------------------------
> [INFO]  T E S T S
> [INFO] -------------------------------------------------------
> [INFO] Running Tests
> [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.008 
> s <<< FAILURE! - in Tests
> [ERROR] Tests  Time elapsed: 0.007 s  <<< FAILURE!
> org.opentest4j.AssertionFailedError: BeforeAll fail
>       at Tests.beforeAll(Tests.java:7)
> [INFO] 
> [INFO] Results:
> [INFO] 
> [ERROR] Failures: 
> [ERROR]   Tests.beforeAll:7 BeforeAll fail
> [INFO] 
> [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
> [INFO] 
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time:  2.373 s
> [INFO] Finished at: 2019-08-20T16:20:16+02:00
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) 
> on project top-level-project: There are test failures.
> {code}
> For all the tests Maven 3.6.1 has been used.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to