testng-team/testng

[Feature Request] allow multiple groups with AND condition

SiKing opened this issue · 2 comments

Currently when running tests with multiple groups, we can use syntax something like mvn test -Dgroups="groupA,groupB". This will run any tests that are tagged with "groupA" OR "groupB".

Please create an option to combine multiple groups with the AND condition. So if I specify something like mvn test -Dgroups="group1+group2", this will run any tests that are tagged with "group1" AND "group2".

There is additional discussion in the testng-users forum, here.

I think this is already possible, I am aware of includeGroups and excludeGroups from testng xml file:
https://testng.org/#_exclusion_groups

You can also take a look at beanshell expressions to define advanced AND OR conditions to include and exclude groups based on your conditions if you have a TESTNG XML file
https://testng.org/#_beanshell_and_advanced_group_selection

Additional information: For my use case, my entire test suite has something like two-dozen different groups. At run time (in CI) I have no way of knowing what are all the groups that have been created. Adding all these as "exclude groups" is not feasible.