When we are using Selenium or any other automation tool (say UFT), we are replicating user interactions on the AUT(Application under Test).But our aim is not only to test AUT, but to comprehend the result of test execution, points of failure(Bug), and reason of the failure, and reporting it to development team or higher management. Thus reporting is the most crucial aspect of our test execution, which helps in keeping an eye on the execution flow or for debugging in case of failures.
Read more on Reporting in UFT
We have already seen the default reporting in TestNG using index.html and emailable-report.html.Further to this we can add our own user friendly logs in the HMTL reporting by using Reporter class. We can also create costume reporting in TestNG using ReportNG
|Reporter.Log as an overloaded method|
Message:-String message for output
logToStandardOut:- is a Boolean value, which signifies whether to print the “Message” on console too. Incase it is set “False”, message won’t be shown in console output of Eclipse.
Console(bolconsole = true)
|Console output in TestNg|
index.html, (inside test-output folder)
|HTML Results in TestNG|
Note:- Incase we are setting (bolconsole=false) in our code, console will not display the “Reporter” messages.
We can implement our own costume reporting in TestNG by implementing:-
- ITestListener Interface
- IReporter Interface