Reputation: 57
Let's assume I have a desktop UI and a mobile UI for the same back-end functionality (e.g. Account, Checkout). Then I would have the following test classes:
@Test(groups = { "desktop", "account" })
public class DesktopAccountTest {}
@Test(groups = { "desktop", "checkout" })
public class DesktopCheckoutTest {}
@Test(groups = { "mobile", "account" })
public class MobileAccountTest {}
@Test(groups = { "mobile", "checkout" })
public class MobileCheckoutTest {}
I will never need to run desktop and mobile tests in the same execution. On the other hand I would like to run all desktop tests, or all mobile tests, which is easy with mvn test -Dgroups="desktop"
or mvn test -Dgroups="mobile"
. But what if I just want to run desktop account tests for example? This doesn't work: mvn test -Dgroups="desktop, account"
: it returns all desktop tests and all account tests.
Is there a way to get the intersection of the 2 groups, rather than their sum? From the command line?
Upvotes: 2
Views: 1093
Reputation: 4034
Another solution could be to create a testng.xml file, for each specific group.
Upvotes: 0
Reputation: 5740
You should try mvn test -Dgroups="desktop,account"-DexcludedGtoups="mobile"
But if you want to run only one test, it is also possible: http://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html
Upvotes: 2