TestNG reporting using ReportNG is not working quite right


(Mark Petrovic) #1

I am using Gradle v1.4.

One of my users is interested in the TestNG listener ReportNG. I’ve been trying to get this test listener to work, but to no avail.

Here are the relevant dependencies

testCompile("org.uncommons:reportng:1.1.2") {
        exclude group: 'org.testng', module: 'testng'
    }
    testCompile "org.testng:testng:6.8"

and here is the test task config:

task intTest(type: Test) {
    useTestNG()
    testClassesDir = sourceSets.intTest.output.classesDir
    classpath = sourceSets.intTest.runtimeClasspath
    outputs.upToDateWhen { false }
    options {
        useDefaultListeners = false
        listeners << 'org.uncommons.reportng.HTMLReporter'
        listeners << 'org.uncommons.reportng.JUnitXMLReporter'
    }
}

When the tests finish running, I see the attached screenshot when I open build/reports/test/html/index.html.

Can someone spot what I’m doing wrong? Or post a config that works for them under Gradle 1.4.

Thanks.


(Szczepan Faber) #2

Hey,

There’s nothing wrong with the way you set up the listeners. It might be worth to disable the Gradle’s html report if you want to use the ReportNG instead.

I don’t know what’s the problem with ReportNG - I couldn’t get it work, too, even with older Gradle versions. It might we worth asking the ReportNG guys what might be the cause of missing tests in the html report.

Can you tell us why do you want to use ReportNG? Gradle 1.4 has greatly improved html reports of TestNG tests.

ReportNG reports have the same issues as the regular TestNG reports: they don’t know about Gradle’s test forking / parallelism. So if your test task happen to configure things like forkEvery or maxParallelForks, the reports become garbage. Therefore (and for other reasons, too) we decided to use our own reporting for TestNG tests I would definitely recommend you to try it out. If you have any suggestions about the reports please let us know.

Hope that helps!


Hey did anyone happen to find a solution for it.......as I am stuck up with the same issue,
(Mark Petrovic) #3

Thank you for the thoughtful reply.

We wanted the ReportNG tests because we were recently using them when our build was a Maven build. When we migrated from Maven to Gradle 1.3, we had problems getting the ReportNG listeners to work, so we backed off and ran with the Gradle default TestNG reports. Those default reports were not so attractive in Gradle 1.3.

I think we will be sufficiently happy with the Gradle 1.4 TestNG reports, however. I was just bothered by the fact I could not get the ReportNG stuff to work, hence my last-resort question above. I’m glad you had trouble, too :wink:

Mark


Hey did anyone happen to find a solution for it.......as I am stuck up with the same issue,