Specify global testNG options


(Anton) #1

Hi everyone,
I would like to specify a global TestNG listener for different tasks that we run (each one has its own xml suite file defined).

first I do:

tasks.withType(Test) {
...
...
  useTestNG {
        listeners << 'com.xxx.xxx.xxx.RetryListener'
        testLogging.showStandardStreams = true
    }
}

then, in the task itself I configure which suite file to use:

task myTest(type:Test){
    useTestNG {
        suites 'suites/myTest.xml'
    }
}

The problem is that second useTestNG call completely overrides the first one, and no listener gets defined.

Is there any way to circumvent that except specifying the listener in each tasks separately?