How to include TestNG tests without a group while including one group and excluding another group?


(Christian Abegg) #1

My projects has three kind of TestNG tests:

@Test(groups="A") // tests in group A
 @Test(groups="B") // tests in group B
@Test // tests not assigned to a specific group

I’d like to configure gradle to run the tests in group A and the non-grouped tests but not the tests in group B.

I tried:

test.options.includeGroups 'A'
test.options.excludeGroups 'B'

But this configuration only runs the tests in group A and not the non-grouped tests.


(Christian Abegg) #2

Inspired by: http://stackoverflow.com/questions/4511297/can-i-run-all-the-testng-tests-that-do-not-belong-to-any-group-in-maven

This does not help either (runs only group A)

test.options.includeGroups 'A'
test.options.includeGroups '.\*'
test.options.excludeGroups 'B'

This leads to a parsing exception:

test.options.includeGroups 'A'
test.options.includeGroups '\*'
test.options.excludeGroups 'B'

(Christian Abegg) #3

The following configuration is working. I do not use any includeGroups.

test.options.excludeGroups 'B'