apache / apache/maven-surefire

[SUREFIRE-1753] Selectively run/exclude JUnit 5 ParameterizedTest

Open
#3,094 3 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

**[Rüdiger zu Dohna](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=t1)** opened **[SUREFIRE-1753](https://issues.apache.org/jira/browse/SUREFIRE-1753?redirect=false)** and commented

The last two sentences [here](https://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html#Multiple_Formats_in_One) don't work any more with JUnit 5:

??The Parameterized JUnit runner describes test methods using an index in brackets, so the non-regex method pattern would become #testMethod[*]. If using the JUnit annotation `@Parameters`(name="{index}: fib({0})={1}") and selecting the index e.g. 5 in pattern, the non-regex method pattern would become #testMethod[5:*].??

See [this SO question](https://stackoverflow.com/questions/60089306/how-do-i-include-exclude-a-junit-5-parameterizedtest-by-name-in-maven).

At least the docs should be updated to reflect this limitation to JUnit 4. It would be really nice to have this feature also for JUnit 5, but I've looked into the code a bit and I have the impression that it's not that easy. I didn't find any tests, either.

---

**Affects:** 2.22.2, 3.0.0-M4

Contributor guide

Open the contributing guide

Research direction

Start with the linked Maven Surefire single-test documentation section, especially the two sentences describing parameterized-test method patterns. Update the text so the limitation to JUnit 4 is explicit and the JUnit 5 behavior is not presented as supported. Done means the documentation accurately reflects JUnit 5 parameterized-test selection.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
documentation, testing
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.