[
https://issues.apache.org/jira/browse/HBASE-3625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13005539#comment-13005539
]
Alejandro Abdelnur commented on HBASE-3625:
-------------------------------------------
Maven surefire plugin supports a {{-Dtest=[<TEST_CLASS_SIMPLE_NAME>,]+}}
property to single out tests to run. An equivalent property is not supported
for singling out tests to exclude.
The surefire configuration supports test exclusions by providing a Test Java
file path {{****/Test**.java}}, the {{<exclusion>}} section supports multiple
paths patterns separated by commas.
Supporting exclusion for
Supporting exclusion for a single test, {{-Dtest.exclude=TestFoo}}, is easy:
{code}
<exclusion>**/Test${test.exclude}.java</exclusion>
{code}
If the {{-Dtest.exclude=}} property is not specified, the pattern will not
resolve to a testcase class.
Supporting exclusion for multiple tests can be done easily if full PATH
patterns are specified,
{{-Dtest.exclude.pattern=***/TestFoo.java,***/TestBar.java}}:
{code}
<exclusion>${test.exclude.pattern}</exclusion>
{code}
Again, if the {{-Dtest.exclude.pattern=}} property is not specified, the
pattern will not resolve to testcases classes.
Both properties can be defaulted in the {{<properties>}} section:
{code}
<properties>
<test.exclude></test.exclude>
<test.exclude.pattern>**/${test.exclude}.java</test.exclude.pattern>
</properties>
{code}
Then a single exclusion is needed for both single test class and test file
patterns.
{code}
<exclusion>${test.exclude.pattern}</exclusion>
{code}
> improve/fix support excluding Tests via Maven -D property
> ---------------------------------------------------------
>
> Key: HBASE-3625
> URL: https://issues.apache.org/jira/browse/HBASE-3625
> Project: HBase
> Issue Type: Improvement
> Components: build
> Affects Versions: 0.90.1
> Environment: all
> Reporter: Alejandro Abdelnur
> Labels: build
>
> Currently the surefire plugin configuration defines the following exclusion:
> {code}
> .
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-plugin</artifactId>
> <configuration>
> <forkMode>always</forkMode>
> <includes>
> <include>**/Test*.java</include>
> </includes>
> <excludes>
> <exclude>**/*$*</exclude>
> </excludes>
> </configuration>
> </plugin>
> {code}
> AFAICT the '{{***/***$**}}' does not resolve to anything meaningful.
> Adding support to exclude one or more tests via Maven property, i.e.
> '{{-Dtest.exclude=<TESTCLASS>}}' would be useful.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira