How to generate testng xml report?


(Nikita Salnikov-Tarnovski) #1

I am using Gradle 1.4 and TestNG tests in my project. I would like to have Gradle’s new html test report, which is nice :), and TestNG’s own xml report for my Jenkins. Right now Gradle generates xml report in JUnit format, not in TestNG format. Do I understand correctly, that the only way to have xml report in TestNG native format is to add ‘org.testng.reporters.XMLReporter’ listener manually?


(René Groeschke) #2

Hello Nikita, I think this is the best way to go to have the new html report created by gradle AND the testng native xml output.

Alternativeley you can use the more convenient property ‘useDefaultListeners’:

test{
    useTestNG{
        useDefaultListeners = true
    }
}

The downside with this approach is, that this also creates the native testng html report, so it’s some kind of overhead.

cheers, René


(Nikita Salnikov-Tarnovski) #3

Thanks, Rene, for quick reply. Now I have the next problem. When I run e.g. 2 test tasks for 2 different suites during the same gradle build, then testng-results.xml report from the second suite overwrites that from the first one. I do understand this is a TestNG’s behaviour. Is there some workaround for it?

P.S. I think it is time to challenge my assumption, that TestNG xml report is better that JUnit’s…