Reputation: 1378
i have 2 maven profiles in my parent/pom.xml file .
The first profile run only a certain group.
<configuration>
<groups>com.XXXXXXX.common.daily.util.UnitTest</groups>
</configuration>
the second profile one run all the tests.
I would like to use an argument on the maven command in the second profile that will exclude this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<groups>com.XXXXXX.common.daily.util.UnitTest</groups>
<skipTests>${skipFastTests}</skipTests>
</configuration>
</plugin>
i don't want to change the pom.xml for the second profile.
I want to know how to add additional parameter for excludedGroups ?
mvn test -P=profile2 ______
Upvotes: 3
Views: 7956
Reputation: 121
You can exclude a category in the plugin configuration in the pom file. But if you want to dynamically exclude a given group via the mvn command line, you can do so by using the 'excludedGroups' parameter like so:
mvn test -DexcludedGroups=com.group.ExcludedCategory
http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#excludedGroups
Upvotes: 12
Reputation: 66
in either surefire or failsafe, add
<excludedGroups>${excluded.tests}</excludedGroups>
and then define this variable excluded.tests
to be the interface that is used in @Category to mark which tests to bypass.
finally, when running an excluded tests in command line, override this value. It seems you are excluding com.XXXXXX.common.daily.util.UnitTest
. Either define it empty in your profile and override with that; or exclude by default but override with empty.
Upvotes: 2