You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "David Georg Reichelt (Jira)" <ji...@apache.org> on 2022/02/12 20:37:00 UTC

[jira] [Comment Edited] (SUREFIRE-2010) Parameterized Selection Does not Work

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

David Georg Reichelt edited comment on SUREFIRE-2010 at 2/12/22, 8:36 PM:
--------------------------------------------------------------------------

Thanks for the hint, so JUnit 5 is not supported currently.

However, as far as I see, this also does not work for JUnit 4. So in the example project, running
{code:java}
mvn clean test -Dtest=*ExampleTestJUnit4#test[1]{code}
also results in an error.

Using JUnit 4, the descriptor has the form
{code:java}
[engine:junit-vintage]/[runner:de.dagere.peass.ExampleTestJUnit4]/[test:%5B1%5D]/[test:test%5B1%5D(de.dagere.peass.ExampleTestJUnit4)]{code}


was (Author: dagere1989):
Thanks for the hint, so JUnit 5 is not supported currently.

However, as far as I see, this also does not work for JUnit 4. So in the example project, running

{{}}
{code:java}
mvn clean test -Dtest=*ExampleTestJUnit4#test[1]{code}
{{}}

also results in an error.

Using JUnit 4, the descriptor has the form
{code:java}
[engine:junit-vintage]/[runner:de.dagere.peass.ExampleTestJUnit4]/[test:%5B1%5D]/[test:test%5B1%5D(de.dagere.peass.ExampleTestJUnit4)]{code}

{{{}{}}}{{{}{}}}

> 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: Minor
>
> 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)