You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jon Harper (Jira)" <ji...@apache.org> on 2024/07/16 16:12:00 UTC

[jira] [Commented] (SUREFIRE-1753) Selectively run/exclude JUnit 5 ParameterizedTest

    [ https://issues.apache.org/jira/browse/SUREFIRE-1753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17866460#comment-17866460 ] 

Jon Harper commented on SUREFIRE-1753:
--------------------------------------

Is this on someone's todo list or are you still waiting on the community to contribute ? 

In its simplest form, I would love to be able to do
mvn test -Dtest=Foo#bar[2]
and have it run only the test for one of the parameterized arguments 

Obviously there is no code for this right now in https://github.com/apache/maven-surefire/tree/master/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform 


only here https://github.com/apache/maven-surefire/blob/a93783a631b14513f6dbaf69c57bae32f37351a0/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/TestMethodFilter.java#L41 using getSource() of the testtemplatedescriptor to filter by methodname, not argumentprovider index or name

> Selectively run/exclude JUnit 5 ParameterizedTest
> -------------------------------------------------
>
>                 Key: SUREFIRE-1753
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1753
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: documentation, JUnit 5.x support
>    Affects Versions: 2.22.2, 3.0.0-M4
>            Reporter: Rüdiger zu Dohna
>            Priority: Major
>
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)