apache / apache/maven-surefire
[SUREFIRE-2010] Parameterized Selection Does not Work
- Dominant language
- Java
- Stars
- 461
- Forks
- 588
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 19
Description
**[David Georg Reichelt](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=dagere1989)** opened **[SUREFIRE-2010](https://issues.apache.org/jira/browse/SUREFIRE-2010?redirect=false)** and commented
In the current version (and also M6-SNAPSHOT), maven surefire is not capable of selecting parameterized tests based on the index. In https://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html, it is described that this should work by providing the index, e.g. using
```java
-Dtest=MyTest#method[$INDEX]
```
or
```java
-Dtest=MyTest#method[*]
```
for all.
This happens both for JUnit 4 and JUnit 5.
I created a mwe demonstrating this problem: https://github.com/DaGeRe/parameterized-selection-demo
As far as I see it, the TestMethodFilter in https://github.com/apache/maven-surefire/blob/master/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/TestMethodFilter.java#L45 does the filtering, but has only a descriptor in the form:
```java
[engine:junit-jupiter]/[class:de.dagere.peass.ExampleTest]/[test-template:test(int)]
```
So there is not the concrete value, but only the information that an int should be provided. Therefore, I currently see not any option to fix this easily or get this running using a regex pattern.
Do I oversee something, or is it planned to fix this? If not, it would be better to update the documentation site accordingly.
---
**Affects:** 3.0.0-M5
**Remote Links:**
- [GitHub Pull Request #476
](https://github.com/apache/maven-surefire/pull/476)
1 votes, 7 watchers
Contributor guide
Research direction
Reproduce the parameterized selection cases from the linked demonstration project, then inspect surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/TestMethodFilter.java, especially the filtering described near line 45. Compare JUnit 4 and JUnit 5 behavior; done means index and wildcard selections work as documented, or the single-test documentation is corrected if they cannot be supported.
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
- 30/100