[ https://issues.apache.org/jira/browse/SUREFIRE-2010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17491877#comment-17491877 ]
Tibor Digana edited comment on SUREFIRE-2010 at 2/14/22, 9:13 AM: ------------------------------------------------------------------ [~DaGeRe1989] It works for me, see this XML report. {code:xml} <testcase name="test[1]" classname="de.dagere.peass.ExampleTestJUnit4" time="0.011"> <system-out><![CDATA[1 ]]></system-out> </testcase> {code} and console output: {noformat} [INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ parameterized-selection-demo --- [INFO] [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running de.dagere.peass.ExampleTestJUnit4 1 [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.118 s - in de.dagere.peass.ExampleTestJUnit4 [INFO] [INFO] Results: [INFO] [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.788 s [INFO] Finished at: 2022-02-14T10:01:25+01:00 [INFO] ------------------------------------------------------------------------ {noformat} As I said the filter with parameterized test works with JUnit4 as it is written in the documentation. We do not support it in JUnit5 yet. Every user should understand why it's that. Once you declare JUnit5 dependency, the plugin would use {{surefire-junit-platform}}. If you delete the Jupiter engine dependency and keep the JUnit 4.13.2, the provide {{surefire-junit4}} is used and there these patterns are supported which is written in the documentation. was (Author: tibor17): [~DaGeRe1989] It works fo me, see this XML report. {code:xml} <testcase name="test[1]" classname="de.dagere.peass.ExampleTestJUnit4" time="0.011"> <system-out><![CDATA[1 ]]></system-out> </testcase> {code} and console output: {noformat} [INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ parameterized-selection-demo --- [INFO] [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running de.dagere.peass.ExampleTestJUnit4 1 [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.118 s - in de.dagere.peass.ExampleTestJUnit4 [INFO] [INFO] Results: [INFO] [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.788 s [INFO] Finished at: 2022-02-14T10:01:25+01:00 [INFO] ------------------------------------------------------------------------ {noformat} As I said the filter with parameterized test works with JUni4 as it is written in the documentation. We do not support it in JUnit5 yet. Every user should understand why it's that. Once you declare JUnit5 dependency, the plugin would use {{surefire-junit-platform}}. If you delete the Jupiter engine dependency and keep the JUnit 4.13.2, the provide {{surefire-junit4}} is used and there these patterns are supported which is written in the documentation. > Parameterized Selection Does not Work > ------------------------------------- > > Key: SUREFIRE-2010 > URL: https://issues.apache.org/jira/browse/SUREFIRE-2010 > Project: Maven Surefire > Issue Type: Bug > Components: Junit 4.x support, JUnit 5.x support > Affects Versions: 3.0.0-M5 > Environment: Maven 3.6.3 and Ubuntu 20.04, but I suppose it happens > everywhere > Reporter: David Georg Reichelt > Priority: Major > > 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 > {code:java} > -Dtest=MyTest#method[$INDEX]{code} > or > {code:java} > -Dtest=MyTest#method[*]{code} > 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: > > {code:java} > [engine:junit-jupiter]/[class:de.dagere.peass.ExampleTest]/[test-template:test(int)]{code} > > 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. -- This message was sent by Atlassian Jira (v8.20.1#820001)