Problem
I want Beautiful report tool where my management gets impressed :-)
Build your own utility
Steps:
1.https://mvnrepository.com/artifact/com.aventstack/extentreports
add below dependency in pom.xml
<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>4.1.7</version>
</dependency>
I want Beautiful report tool where my management gets impressed :-)
Build your own utility
Steps:
1.https://mvnrepository.com/artifact/com.aventstack/extentreports
add below dependency in pom.xml
<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>4.1.7</version>
</dependency>
Create a new class with ExtentReporterNG
package ExtentReport.ExtentReports;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.reporter.ExtentSparkReporter;
public class ExtentReporterNG {
static ExtentReports extent;
public static ExtentReports getReportObject() {
// ExtentReports ExtentSparkReporter
String path = System.getProperty("user.dir") + "\\reports\\index.html";
ExtentSparkReporter reporter = new ExtentSparkReporter(path);
reporter.config().setReportName("DemoReport");
reporter.config().setDocumentTitle("DemoTitle");
extent = new ExtentReports();
extent.attachReporter(reporter);
extent.setSystemInfo("Tester", "Manju");
return extent;
}
}
Go through TestNG Listener class
Note:
Add testng.xml with test class
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="tests">
<listeners>
<listener class-name = "ExtentReport.ExtentReports.Listeners"></listener>
</listeners>
<test thread-count="5" name="Test">
<classes>
<class name="ExtentReport.ExtentReports.DemoReport" />
<class name="ExtentReport.ExtentReports.TestFail" />
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
No comments:
Post a Comment