3
votes

Trying to understand how TestNG concatenates method name + group name + description to display on report. I have a test suite which only shows the method name on my TestNG report but then I have other test suites that are concatenating the test description after the method name and displaying that entire string on the report (under the 2nd column after the class name column). I can't figure out what controls this difference.

Does anyone understand how this works and is enabled/disabled in the suite? In this scenario, TestNG is being executed by the Maven Surefire plugin, which as you know, places the emailable report under the "target" directory rather than under "testng-output".

Also, an additional detail I am wondering about is: can the description be altered during the Test method so that the altered description can be shown on the report?

This screenshot shows the favorable display of group and description but I have many other test suites that do not show this information and I want to know how to enable it.

enter image description here

2
Which report are you referring to?niharika_neo
I'm referring to the TestNG report generated by Maven Surefire, during the test phase, (with its reference to the testng suite .xml file). This report shows a "console" section that shows all the output from every call to Reporter.log() while the test was running.djangofan

2 Answers

1
votes

Not sure about the report generated by SureFire, but if you use TestNG without Maven it generates two reports - emailable-report, index. Both display the same data but in different presentation. And we can customize the report content by creating a listener and overriding the default methods.

Refer this post on how to customize the report.

0
votes

To your first question, it seems old versions of testng (prior to 6.8.1) used to have emailablereporter as its default reporter. Later versions have emailablereporter2 as it's default which doesn't show description. Try specifying listener as below to see descriptions against methods.

<listener class-name="org.testng.reporters.EmailableReporter"></listener>

The description can be altered by implementing IAnnotationTransformer.