You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Zhenxu Ke (Jira)" <ji...@apache.org> on 2020/05/20 14:52:00 UTC

[jira] [Created] (SUREFIRE-1794) @TestFactory method succeeds when throwing an exception with Maven Failsafe plugin

Zhenxu Ke created SUREFIRE-1794:
-----------------------------------

             Summary: @TestFactory method succeeds when throwing an exception with Maven Failsafe plugin
                 Key: SUREFIRE-1794
                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1794
             Project: Maven Surefire
          Issue Type: Task
            Reporter: Zhenxu Ke


Hi, this is an issue transferred from [https://github.com/junit-team/junit5/issues/2303]

 
h2. Steps to reproduce

Here is a reproducible test:

 
{code:java}
@TestFactory
    List<DynamicNode> tests() {
        int a = 1 / 0;  // intentionally throws
        return Arrays.asList(
            DynamicContainer.dynamicContainer(
                "dynamic container 1",
                Stream.of(
                    DynamicTest.dynamicTest("dynamic test 1", () -> fail("")),
                    DynamicTest.dynamicTest("dynamic test 2", () -> fail(""))
                )
            ),
            DynamicContainer.dynamicContainer(
                "dynamic container 2",
                Stream.of(
                    DynamicTest.dynamicTest("dynamic test 3", () -> fail("")),
                    DynamicTest.dynamicTest("dynamic test 4", () -> fail(""))
                )
            )
        );
    }{code}
 

the test above succeeded if `{{int a = 1 / 0`}} is present, and failed as expected if I remove it, showing 4 tests executed and all of them failed.
h2. Context
 * Used versions (Jupiter/Vintage/Platform):

 
{code:java}
<dependency>
  <groupId>org.junit.jupiter</groupId>
  <artifactId>junit-jupiter</artifactId>
  <version>5.6.0</version>
</dependency>
{code}
 * Build Tool/IDE:

maven-failsafe-plugin, with all necessary dependencies configured
 
{code:java}
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.0.0-M4</version>
                <dependencies>
                    <!-- not important, thus omitted -->
                </dependencies>
            </plugin>
{code}
h2. Deliverables

I'm expecting the tests to be failed if the {{TestFactory}} method throws



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