[ 
https://jira.codehaus.org/browse/SUREFIRE-806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=285946#comment-285946
 ] 

John Casey commented on SUREFIRE-806:
-------------------------------------

I've been looking at the code, and it seems like the most elegant solution 
might be to create a new implementation of ScannerFilter that would wrap any 
provider-specific filters in the event -Dtest= is specified on the command 
line. Then, rather than including the -Dtest= classes in the includes for the 
scanner, they would be managed via a separate property list, and populate the 
new filter. When the DirectoryScanner filters the classes it finds based on 
includes/excludes, the new ScannerFilter would first make sure (a) the tests 
list is empty, or (b) the class matches something in the tests list...if it did 
match, it would pass the class on to the provider-specific filter for ultimate 
acceptance.

This requires three basic changes:

1. Alter the handling of -Dtest= so the enumerated tests are serialized in a 
different list of properties (not in the includes list)
2. Read the new property list for -Dtest=, and use it to construct a new 
ScannerFilter that wraps the provider-specific one. If -Dtest= is specified, 
only allow classes that match that property list (subject to the 
provider-specific filter's acceptance).
3. Provide a flag to turn on/off this test-vs-includes separation. When off, 
the -Dtest= properties would be used as includes, and everything acts as it 
does today. Otherwise, steps 1 and 2 are executed.

As far as the flag used to turn on this option, I'm less sure...maybe something 
like <filterCLITests>true|false</filterCLITests>?
                
> Make ignoring of <includes> and <excludes> on -Dtest=... optional (for 
> multiple Surefire executions)
> ----------------------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-806
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-806
>             Project: Maven Surefire
>          Issue Type: Improvement
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.11
>            Reporter: Ondrej Zizka
>            Assignee: John Casey
>         Attachments: surefire-806-testParam-hits-all-executions.zip
>
>
> Let's have a single module with multiple Surefire executions (e.g. with 
> different Arquillian configs)
> Tests are divided to run in either one, using <includes> and <excludes>.
> Then, if you use -Dtest=..., the specified test(s) is run twice - once for 
> each execution (and usually fails in one of them in our scenario).
> My suggestion is to introduce a Surefire config property which would make 
> this behavior optional:
> {code}
> <configuration>
>   <ignoreIncludesOnSingleTest>false</ignoreIncludesOnSingleTest>
> </configuration>
> {code}
> This would cause Surefire to run the intersection of the two sets -
> one created by the mask from -Dtest=...,
> second created by the includes and excludes of the respective execution.
> Current description from 
> http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html :
> {quote}
> Specify this parameter to run individual tests by file name, overriding the 
> includes/excludes parameters. Each pattern you specify here will be used to 
> create an include pattern formatted like **/${test}.java, so you can just 
> type "-Dtest=MyTest" to run a single test called "foo/MyTest.java".
> This parameter overrides the includes/excludes parameters, and the TestNG 
> suiteXmlFiles parameter.
> {quote}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to