Istvan Toth created SUREFIRE-2300:
-------------------------------------
Summary: Surefire does not report test classes skipped from JUnit5
@BeforeAll methods
Key: SUREFIRE-2300
URL: https://issues.apache.org/jira/browse/SUREFIRE-2300
Project: Maven Surefire
Issue Type: Bug
Reporter: Istvan Toth
When a test class is skipped/aborted by a Junit 5 assumption in the @BeforeAll
method, surefire does not give an indication that the test class, and all the
tests in it were skipped.
Surefire currently reports something like this in this case:
{noformat}
[INFO] Running org.apache.hadoop.yarn.server.timelineservice.storage.TestAssume
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.012 s
-- in org.apache.hadoop.yarn.server.timelineservice.storage.TestAssume
{noformat}
I think that the report should look something like this instead:
(i.e. report all found test methods in the class as skipped)
{noformat}
[INFO] Running org.apache.hadoop.yarn.server.timelineservice.storage.TestAssume
[WARN] Tests run: 0, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.012 s
-- in org.apache.hadoop.yarn.server.timelineservice.storage.TestAssume
{noformat}
The information, including the found tests is made available by junit5:
{noformat}
java -jar junit-platform-console-standalone-1.12.1.jar --class-path .
--scan-class-path
💚 Thanks for using JUnit! Support its development at
https://junit.org/sponsoring
â•·
├─ JUnit Platform Suite ✔
├─ JUnit Jupiter ✔
│ └─ TestAssume ■Assumption failed: assumption is not true
└─ JUnit Vintage ✔
Test run finished after 37 ms
[ 4 containers found ]
[ 0 containers skipped ]
[ 4 containers started ]
[ 1 containers aborted ]
[ 3 containers successful ]
[ 0 containers failed ]
[ 1 tests found ]
[ 0 tests skipped ]
[ 0 tests started ]
[ 0 tests aborted ]
[ 0 tests successful ]
[ 0 tests failed ]
WARNING: Delegated to the 'execute' command.
This behaviour has been deprecated and will be removed in a future
release.
Please use the 'execute' command directly.
{noformat}
Minimal repro test:
{noformat}
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
public class TestAssume {
@BeforeAll public static void before() {
Assumptions.assumeTrue(false);
}
@Test public void test() {
}
}
{noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)