apache / apache/maven-surefire

[SUREFIRE-1207] A new JVM is forked even for tests not matching the "groups" tag when "reuseForks" is false

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

Description

**[Michael Comerford](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=mcomerford)** opened **[SUREFIRE-1207](https://issues.apache.org/jira/browse/SUREFIRE-1207?redirect=false)** and commented

When the "groups" tag is used with "resuseForks" as false, a new fork is created for every test, not just the one in the group tag. The tests which don't match the group aren't ran, but a fork is still created and destroyed for every test, which is very inefficient.

Example:

```xml

maven-surefire-plugin

true



default-tests
test

test


false
IsolatedTests



isolatedTests
test

test


false
IsolatedTests
1
false


```

The forking can be seen when running maven in debug mode: `mvn test -X` and searching for the text "Forking command line"

---

**Affects:** 2.18.1

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the Maven Surefire configuration in the report, running `mvn test -X` and searching for "Forking command line". Trace how groups, excludedGroups, and reuseForks are handled; done means excluded tests do not create or destroy forked JVMs.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.