07 - 03 - TestNG Report Generation in Selenium WebDriver
07 - 03 - TestNG Report Generation in Selenium WebDriver
1
RBVH/ENG1
Content
Method-1: emailable-report.html
Method-2: index.html
Method-3: Reporter Class
2
Method-1: emailable-report.html
3
Method-1: emailable-report.html
4
Method-1: emailable-report.html
5
Method-1: emailable-report.html
6
Method-2 index.html
1.Right click on the index.html from the project directory.
2.Select option open with web browser option. It will display the result in the following order
7
Method-2 index.html
8
Method-3 Reporter Class
Along with these report generated methods, you can use object.properties file to store
the system generated logs as well as user generated logs. But one of the simplest ways
to store log information in testing is using Reporter Class.
9
Example:
Create Two classes such as DemoA and DemoB and write the following code inside the classes.
For Class DemoA;
•The Code for DemoA is already explained above. Here you are using log method of Reporter class. (For
implementing a reporting class, the class has to implement an org.testng.IReporter interface).
•The log method is a static method of Reporter class. So you are accessing that method through the
Reporter class.
•The log method is used to store log information that is written inside the program. By looking at the log
information, you will easily come to know where exactly the execution of the program is stopped.
10
Example:
11
Example:
12
Example:
Click on reporter output. It will open logging info whatever written in the test
methods.
13
RBVH/ENG1
Reference
https://www.guru99.com/testng-report.html
14