apache / apache/maven-surefire

[SUREFIRE-2034] Cannot combine in-/excludes with '-DTest'

Open
#2,612 0 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

**[Alexander Kriegisch](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=kriegaex)** opened **[SUREFIRE-2034](https://issues.apache.org/jira/browse/SUREFIRE-2034?redirect=false)** and commented

Something that works in Surefire 2.22.2 does not work in 3.0.0-M5 and 3.0.0-M6-SNAPSHOT anymore: the combination of in-/excludes with `-Dtest=MyTest`. My situation is as follows:

```xml

maven-surefire-plugin



default-test
test

test


none:none

**/*TestNG*
**/*JUnit4*




testng-test
test

test


none:none

**/*TestNG*
**/*JUnit4*



```

The result when running `mvn test -Dtest=MyTest` is that both executions execute that test, even though in the second one it is not part of the `include` patterns. In 2.22.2 this works as expected.

---

**Affects:** 3.0.0-M5, 3.0.0-M6

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the two Surefire executions shown in the report by running `mvn test -Dtest=MyTest` on Surefire 3.0.0-M5 or M6-SNAPSHOT, then compare it with 2.22.2. Trace how the `-Dtest` selection interacts with the include and exclude patterns; done means the selected test runs only in executions whose patterns include it.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.