maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Elsner (Jira)" <j...@apache.org>
Subject [jira] [Comment Edited] (SUREFIRE-1134) Take list of tests from file (-Dtest has upper limits for comma-separated list of tests)
Date Mon, 17 Feb 2020 19:22:00 GMT

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

Daniel Elsner edited comment on SUREFIRE-1134 at 2/17/20 7:21 PM:
------------------------------------------------------------------

@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.

 

If you think I have a point, I would also volunteer to implement this feature.


was (Author: delsner):
@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)

Mime
View raw message