As we are aware Selenium is an open source tool, hence no proper reporting is available. If reports has to be generated, then we need to use our own Reporting Structure. In this example , we are using how to find the default reports generated by TestNG.
In the previous example, we saw how to create and run TestNG reports. If you have not read the previous example, I would suggest you to go through the previous example.
Step 1 : Below is the example we are going to execute.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
package TestNGExamples; import org.testng.annotations.Test; public class testngExample1 { @Test public void testngMethod1() { System.out.println("Executed testNgMethod1"); } @Test public void testngMethod2() { System.out.println("Executed testNgMethod2"); } } |
Step 2 : To execute or run the script. Right click and Select the TestNG Test.
TestNg-Running-Script
Step 3 : Observe the output in the console as below. With pass or failed status and number of test cases.
Testng-Execution-Report
Step 4 : Since we cannot share the console output to the customer. We need to have some HTML kind of reports to share and track the results on a daily basis.
Step 5 : By default, first time the TestNg html reports will not be available.
Testng-Report-Display
Step 6 : Hence we need to go to the project name TestNG_Demo. Right click on the project and click refresh.
Testng-Project-Refresh
Step 7 : Observe after the refresh happens. We are able to see the Test-output Folder is created.
Testng-Test-Output-Folder
Step 8 : In Test-output folder, there will be 2 HTML reports generated as shown in the screenshot.
Testng-First-Html-Report
Step 9 : First, HTML report Emailable-report.html
To open the reports right click on the Emailable-report.html file and select as open with the browser.
Testng-Emailable-Report-Web-Browser
Step 10 : Reports looks like this.
Testng-Emailable-Report-Display
Step 11 : Second, index.html right click on the index.html file and open with Web Browser.
Testng-Index-Html-File
Step 12 : The index.html report looks like below.