logo

The best IT Trainig Institute In Gurgaon

TestNG Report Generation in selenium | Part-1

Steps to Run this method
  • First Create a new class in a Regular package And Write given below code
package asc;

import org.testng.Assert;
import org.testng.Reporter;
import org.testng.annotations.Test;

import common.BaseTest;

public class Report extends BaseTest{
	
	@Test
	public void reporterTest1() {
		System.out.println("This is test 1");
	}
	
	@Test
	public void reporterTest2() {
		Reporter.log("This is test 2");
		System.out.println("This is test 2");
	}
	
	@Test
	public void reporterTest3() {
		Reporter.log("This is test 3");
		System.out.println("This is test 3");
	}
	
	@Test
	public void reporterTest4() {
		System.out.println("This is test 4");
	}
	
	@Test
	public void reporterTest5() {
		System.out.println("This is test 5");
	}

}

                
  • And then run the code.
  • After running the code you will see the report in the console.
  • Reporter.log() is used to log the message in the report.
  • This Report.log cannot be seen in console because it is the output so, if you want to see the output then refresh the your project.
  • Then you find the test-output folder in your project.
  • Open that folder And in that you get the index.html.
  • Right click on index.html And go to the open with And click on Web Browser.
  • And the you the report of the class which you had been run.
  • Check the Report