apache / apache/maven-surefire

[SUREFIRE-2033] Regression: 3.0.0-M5 misidentifies JUnit 5 configuration as JUnit 4

Open
#2,666 17 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
461
Forks
588
Avg merge
1d 8h
Merged PRs (30d)
19

Description

**[Robert James Oxspring](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=roxspring)** opened **[SUREFIRE-2033](https://issues.apache.org/jira/browse/SUREFIRE-2033?redirect=false)** and commented

3.0.0-M5 misidentifies a clearly JUnit 5 configuration and attempts to run using JUnit 4.

In particular the attached project only has JUnit 5 dependencies:

```java


org.junit.jupiter
junit-jupiter-engine
5.6.2
test


org.junit.platform
junit-platform-runner
1.6.2
test

```

and a JUnit 5 test:

```java
package pkg;

import org.junit.jupiter.api.Test;

class JUnit5Test {
@Test
public void test() {

}
}
```

When the project is run with with older version (as far back as 2.22.0) the test is found and run, but 3.0.0-M5 fails to run any test:

```java
% mvn test -Dsurefire.version=2.22.0 | tail
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.337 s
[INFO] Finished at: 2022-03-03T09:42:27Z
[INFO] ------------------------------------------------------------------------
```

 

```java
% mvn test -Dsurefire.version=3.0.0-M1 | tail
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.708 s
[INFO] Finished at: 2022-03-03T09:34:58Z
[INFO] ------------------------------------------------------------------------

% mvn test -Dsurefire.version=3.0.0-M2 | tail
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.701 s
[INFO] Finished at: 2022-03-03T09:36:26Z
[INFO] ------------------------------------------------------------------------

% mvn test -Dsurefire.version=3.0.0-M3 | tail
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.612 s
[INFO] Finished at: 2022-03-03T09:37:02Z
[INFO] ------------------------------------------------------------------------

% mvn test -Dsurefire.version=3.0.0-M4 | tail
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.619 s
[INFO] Finished at: 2022-03-03T09:37:37Z
[INFO] ------------------------------------------------------------------------

% mvn test -Dsurefire.version=3.0.0-M5 | tail
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.344 s
[INFO] Finished at: 2022-03-03T09:38:01Z
[INFO] ------------------------------------------------------------------------
```

Note the final run above using 3.0.0-M5 and logging: `Tests run: 0`

---

**Affects:** 3.0.0-M5

**Attachments:**
- [example.zip](https://issues.apache.org/jira/secure/attachment/13040678/example.zip) (_1.50 kB_)

**Issue Links:**
- [SUREFIRE-1920](https://issues.apache.org/jira/browse/SUREFIRE-1920) After adding junit-platform-runner dependency, Junit 5 test cases are ignored

- [SUREFIRE-2036](https://issues.apache.org/jira/browse/SUREFIRE-2036) Regression: 3.0.0-M5 fails with configured JUnit 5 provider

- [SUREFIRE-1963](https://issues.apache.org/jira/browse/SUREFIRE-1963) Detecting multiple test-frameworks

1 votes, 5 watchers

Contributor guide

Open the contributing guide

Research direction

Start with the attached example.zip and reproduce the regression using `mvn test -Dsurefire.version=3.0.0-M5`, comparing it with 3.0.0-M4 and earlier versions. Investigate how the JUnit 5 dependencies and test are identified; done means the example reports one test run with 3.0.0-M5, as it does with the earlier versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.