You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Daniel Elsner (Jira)" <ji...@apache.org> on 2020/02/17 19:13:00 UTC

[jira] [Commented] (SUREFIRE-1134) Take list of tests from file (-Dtest has upper limits for comma-separated list of tests)

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

Daniel Elsner commented on SUREFIRE-1134:
-----------------------------------------

@Tibor You are right, it is possible to select specific *test classes* with `-Dsurefire.includesFile` etc., but it is not possible to select specific *test cases*, e.g., test methods with `@Test` annotation in JUnit. This is a limitation, as one might only want to include specific test cases rather than entire test classes.

It is implemented here: https://github.com/apache/maven-surefire/blob/master/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L2092

Of course, you can still use `-Dtest` to specify methods, but this has its restrictions, as for example in Windows environments, you cannot have more than 8192 characters in a single command (e.g. powershell/cmd.exe). Hence, selecting a few hundred tests with long package names will fail.

Maybe we could either remove the check for method names in `Dsurefire.includesFile` or add `-DtestListFile=testsToRun.txt` as @Paul suggested above. 

 

> Take list of tests from file (-Dtest has upper limits for comma-separated list of tests)
> ----------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-1134
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1134
>             Project: Maven Surefire
>          Issue Type: New Feature
>            Reporter: Paul Hammant
>            Assignee: Tibor Digana
>            Priority: Minor
>             Fix For: 2.19
>
>
> -Dtest=TestOne,foo.BarTest is the way to go for constraining surefire to a list of tests.  There are upper limits to that in the context of command line arguments.
> Could we additionally have:
> {panel:title=Example mvn param|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#FFFFCE}
> -DtestListFile=testsToRun.txt
> {panel}
> Also for Failsafe:
> {panel:title=Example mvn param|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#FFFFCE}
> -Dit.testListFile=testsToRun.txt
> {panel}
> Yes, I'd be rewriting testsToRun.txt for my use case, just before invoking Maven.
> Refer http://paulhammant.com/2015/01/11/reducing-test-times-by-only-running-impacted-tests/



--
This message was sent by Atlassian Jira
(v8.3.4#803005)