Extent Report in Kotlin

ExtentReportKotlin

   We know that TestNG itself providing an HTML report and the report will generate in the test-output folder of your project structure. In my previous articles, already discussed the implementation of Extent Report with TestNG+Java and NUnit+C#. Here, I would like to share the details on the implementation of the Extent Report using Kotlin language and controlled by TestNG.

    We know that Kotlin is a general-purpose, open-source, statically typed programming language initially designed for the JVM (Java Virtual Machine) and Android that combines object-oriented and functional programming features. Let’s discuss the implementation of the Extent Report using Kotlin language.

Extent Report using Kotlin

Prerequisites

Following are the prerequisites to implement Extent Report using Kotlin,

  • Install Java SDK 8 and above.
  • Install Eclipse or IntelliJ IDEA IDEs.
  • Install the Kotlin plugin in IDEs. Here I am using Eclipse as IDE and Kotlin plugin for Eclipse downloaded from https://marketplace.eclipse.org/content/kotlin-plugin-eclipse
  • The latest version of following maven dependencies:
    • testng
    • selenium-java
    • selenium-server
    • kotlin-test
    • kotlin-stdlib-jdk8
    • extentreports

Step-by-step procedure

Step 1: Create a maven project and add the above dependencies in pom.xml of the project.

Step 2: Create a Kotlin class to keep the logic to generate the Extent Report. Let say the class name as AutomationReport. Here I am using ITestListener interface of TestNG to control the executions and results. Below is the code snippet of the AutomationReport class to implements the ITestListener and declare the objects for ExtentSparkReporter, ExtentReports, and ExtentTest,

class AutomationReport : ITestListener {

public lateinit var sparkReporter: ExtentSparkReporter
public lateinit var extentReport: ExtentReports
public lateinit var extentTest: ExtentTest

…}

Step 3: Create an override method onStart() with logic to generate an HTML template for the test report,

override fun onStart(testContext: ITestContext) {
try {
sparkReporter = ExtentSparkReporter(System.getProperty(“user.dir”) + “/AutomationReport/”)
sparkReporter.config().setDocumentTitle(“Kotlin Automation”)
sparkReporter.config().setReportName(“Automation Execution Report”)
sparkReporter.config().setTheme(com.aventstack.extentreports.reporter.configuration.Theme.DARK)
extentReport = ExtentReports()
extentReport.attachReporter(sparkReporter)
extentReport.setSystemInfo(“Application Name”, “Kotlin Report Demo”)
extentReport.setSystemInfo(“Platform”, System.getProperty(“os.name”))
extentReport.setSystemInfo(“Environment”, “QA”)

} catch (e: Exception) {
e.printStackTrace()
}
}

Step 4: Create an override method onTestStart() with logic to collect current test case name and add it to the report,

override fun onTestStart(result: ITestResult) {
var testName: String = result.getMethod().getMethodName()
extentTest = extentReport.createTest(testName)
}

Step 5: Create an override method onTestSuccess() with logic to add pass status to the report,

override fun onTestSuccess(result: ITestResult) {
var testName: String = result.getMethod().getMethodName()
try {
extentTest.log(
Status.PASS,
MarkupHelper.createLabel(testName + ” Test Case PASSED”, ExtentColor.GREEN)
)
} catch (e: Exception) {
e.printStackTrace()
}
}

Step 6: Create an override method onTestSkipped() with logic to add skip status to the report,

override fun onTestSkipped(result: ITestResult) {
var testName: String = result.getMethod().getMethodName()
try {
extentTest.log(
Status.SKIP,
MarkupHelper.createLabel(testName + ” Test Case SKIPPED”, ExtentColor.ORANGE)
)
} catch (e: Exception) {
e.printStackTrace()
}
}

Step 7: Create an override method onTestFailure() with logic to add fail status to the report,

override fun onTestFailure(result: ITestResult) {
var driver: WebDriver
var currentClass = result.getInstance()
var testName: String = result.getMethod().getMethodName()
try {
driver = (currentClass as AutomationBase).getDriverInstance()
var screenshotPath = Utilities().screenshotCapture(driver, result.getName())
extentTest.log(
Status.FAIL,
MarkupHelper.createLabel(testName + ” Test Case FAILED”, ExtentColor.RED)
)
extentTest.log(
Status.FAIL,
MarkupHelper.createLabel(“Reason for Failure: ” + result.getThrowable().toString(), ExtentColor.RED)
)
extentTest.addScreenCaptureFromPath(screenshotPath)
} catch (e: Exception) {
e.printStackTrace()
}
}

Step 8: Create an override method onFinish() with logic to store HTML report to the specified path  and flush extent report instance,

override fun onFinish(testContext: ITestContext) {
try {
extentReport.flush()
val dateFormat = SimpleDateFormat(“dd-MMM-yyyy_HH-mm-ss”)
val date = Date()
val filePathdate: String = dateFormat.format(date).toString()
var actualReportPath: String = System.getProperty(“user.dir”) + “/AutomationReport/” + “index.html”
File(actualReportPath).renameTo(
File(
System.getProperty(“user.dir”) + “/AutomationReport/”
+ “Automation_Report_” + filePathdate + “.html”
)
)
} catch (e: Exception) {
e.printStackTrace()
}
}

Step 9: Create another class called Utilities to keep common utility functions required for automation. Here I just added one utility to capture the screenshot. In onTestFailure() method, I already used a method called screenshotCapture(). Below is the code snippet to capture the screenshot,

fun screenshotCapture(driver: WebDriver, fileName: String): String {
var destination: String = “”
try {
var scrFile = (driver as TakesScreenshot).getScreenshotAs(OutputType.FILE)
var dateFormat = SimpleDateFormat(“yyyyMMddHHmmss”)
var cal = Calendar.getInstance()
var path = File(“Failure_Screenshots”).getAbsolutePath()
destination = path + “/” + fileName + dateFormat.format(cal.getTime()) + “.png”
scrFile.copyTo(File(destination))
} catch (e: Exception) {
e.printStackTrace()
}
return destination
}

Step 10: Prior to starting the automation execution, you have to map the AutomationReport class to your test runner class (the class which starting your driver instance within TestNG annotation). You can represent AutomationReport class in test runner class as below,

@Listeners(AutomationReport::class)

Step 11: Now you can run your test cases using testng.xml and once execution complete the HTML report will generate inside the AutomationReport folder in the project structure.

     I hope you got an idea of Extent Report implementation using Kotlin language. Try to use the above step-by-step procedure in your automation world and explore it.

make it perfect!

 

Extension to Extent Report 3

maxresdefault

         This article is an extension of Extent Report TestNG which helps you to use the latest Extent report library 4 series introduced by aventstack. This is the time to migrate version 3 to 4. Here I would like to share the basic changes in version 4. The first thing is ExtentHtmlReporter class deprecated and introduced ExtentSparkReporter.

      ExtentSparkReporter is the default version 4 reporter supporting both BDD and non-BDD test styles. The ExtentSparkReporter creates a rich standalone spark file. It allows several configuration options via the config() method. In the new version, no need to load the extent-config.xml via code. The library itself configure the default style for the HTML report but we have to specify the directory path to store HTML report before start the test suite. We can also specify the themes for the HTML report, it supports DARK and STANDARD themes.

   As usual, the object of ExtentReports class helps to attach the object of ExtentSparkReporter and also to set system information in the HTML file, map each test into the HTML report. Finally, we have to flush the object o ExtentReports class. The object of ExtentTest class helps to keep track of the status of each test case into the HTML report with assign specific color for the test.

Prerequisites to Generate Extent Reports:

  1. Java should be installed and setup Java
  2. TestNG maven dependency should be available
  3. Extent Report Maven dependency should be available

<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>4.1.3</version>
</dependency>

Below is the code snippet for before suite,

public static ExtentSparkReporter sparkReporter;
public static ExtentReports extentReport;
String reportPath = System.getProperty(“user.dir”) + “/AutomationReport/”;

sparkReporter = new ExtentSparkReporter(reportPath);
sparkReporter.config().setDocumentTitle(“Appium Automation”);
sparkReporter.config().setReportName(“Automation Execution Report”);
sparkReporter.config().setTheme(com.aventstack.extentreports.reporter.configuration.Theme.DARK);
extentReport = new ExtentReports();
extentReport.attachReporter(sparkReporter);
extentReport.setSystemInfo(“Application Name”, “ExtentReport”);
extentReport.setSystemInfo(“Platform”, System.getProperty(“os.name”));
extentReport.setSystemInfo(“Environment”, “QA”);

     Below is the code snippet to collect the test method name prior to each test execution. This logic you can add before method section,

String className = this.getClass().getSimpleName();
extentTest = extentReport.createTest(className + “-” + method.getName()); //method object of Method class should be passed to get the method name.

     Below is the code snippet to collect the test results after each test execution and map those results into the HTML report. You can use the below logic after method section,

public static ExtentTest extentTest;

String methodName = result.getName();
extentTest.createNode(methodName);
if (result.getStatus() == ITestResult.FAILURE) {
extentTest.log(Status.FAIL, MarkupHelper.createLabel(methodName + ” – Test Case Failed”, ExtentColor.RED));
extentTest.log(Status.FAIL,
MarkupHelper.createLabel(result.getThrowable() + ” – Test Case Failed”, ExtentColor.RED));
// Here you can add screenshot in the report for fail case
extentTest.fail(methodName + “Test Step Failed”);
}
if (result.getStatus() == ITestResult.SKIP) {
extentTest.log(Status.SKIP,
MarkupHelper.createLabel(result.getName() + ” – Test Case Skipped”, ExtentColor.ORANGE));
extentTest.skip(methodName + “Test Step Skipped”);
}
if (result.getStatus() == ITestResult.SUCCESS) {
extentTest.log(Status.PASS,
MarkupHelper.createLabel(result.getName() + ” Test Case PASSED”, ExtentColor.GREEN));
extentTest.pass(methodName + “Test Step Passed”);
}

     The below final code snippet helps to flush the object of the ExtentReports class and also rename the generated file name with time-stamp. By default, the library will generate index.html file. After suite, we can rename the HTML report along with flushing the object of the ExtentReports class.

extentReport.flush();
DateFormat dateFormat = new SimpleDateFormat(“dd-MMM-yyyy_HH-mm-ss”);
Date date = new Date();
String filePathdate = dateFormat.format(date).toString();
String actualReportPath = reportPath + “index.html”;
new File(actualReportPath).renameTo(new File(
System.getProperty(“user.dir”) + “/AutomationReport/” + “Automation_” + filePathdate + “.html”));

Below are the sample screenshots of the generated HTML report.

Report2

Report3

Report1

Try to migrate your extent report 3 versions to 4 series and enjoy the differences.

make it perfect!

Extent Reports in Automation – NUnit

Captujjkre

     I observed that the difficulty to generate rich HTML report in Automation using NUnit. One day, I thought to build a custom beautiful high rich HTML reports with minimum effort; that time I used AventStack’s Extent Report. Here, I would like to share the details on the integration and implementation of Extent Report utility in Automation test classes that built with NUnit.

Prerequisites to Generate Extent Reports:

  1. Visual Studio 2017 should be installed. Reference click here.
  2. NUnit and NUnit3TestAdapter should be installed via package manager. Reference click here.
  3. Selenium.WebDriver and Selenium.Support should be installed via package manager. Reference click here.
  4. ExtentReports package should be installed via package manager.

Set up Visual Studio with ExtentReports:

Step 1: Navigate to Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution
Step 2: In the next window,

  1. Search for “ExtentReports”.
  2. Select the first search result “ExtentReports”.
  3. Check the project checkbox.
  4. Select the desired version. Better to select latest version.
  5. Click on ‘Install’.

Steps To Generate Extent Reports:

  1. Firstly, create a  Console App (.Net Framework) project.
  2. Create a c# class say ‘SeleniumExtentReport’ and add following code to it,

using System;
using System.Text;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using AventStack.ExtentReports;
using System.IO;
using AventStack.ExtentReports.Reporter;
using NUnit.Framework;
using NUnit.Framework.Interfaces;
using System.Threading;

namespace SeleniumExtentReportTest
{
[TestFixture]
public class SeleniumExtentReport
{
public IWebDriver driver;
protected ExtentReports _extent;
protected ExtentTest _test;

///For report directory creation and HTML report template creation
///For driver instantiation
/// Author: Sanoj
/// Since: 23-Sep-2018
[OneTimeSetUp]
public void BeforeClass()
{
try
{
//To create report directory and add HTML report into it

_extent = new ExtentReports();
var dir = AppDomain.CurrentDomain.BaseDirectory.Replace(“\\bin\\Debug”, “”);
DirectoryInfo di = Directory.CreateDirectory(dir + “\\Test_Execution_Reports”);
var htmlReporter = new ExtentHtmlReporter(dir + “\\Test_Execution_Reports” + “\\Automation_Report” + “.html”);
_extent.AddSystemInfo(“Environment”, “Journey of Quality”);
_extent.AddSystemInfo(“User Name”, “Sanoj”);
_extent.AttachReporter(htmlReporter);
}
catch (Exception e)
{
throw (e);
}

try
{
driver = new ChromeDriver();
}
catch (Exception e)
{
throw (e);
}
}

///Getting the name of current running test to extent report
/// Author: Sanoj
/// Since: 23-Sep-2018
[SetUp]
public void BeforeTest()
{
try
{
_test = _extent.CreateTest(TestContext.CurrentContext.Test.Name);
}
catch (Exception e)
{
throw (e);
}
}

[Test]
public void PassTest()
{
Assert.IsTrue(true);
}
[Test]
public void FailTest()
{
driver.Url=”http://google.com&#8221;;
Assert.AreEqual(driver.Title, “Journey”);
}

/// Finish the execution and logging the detials into HTML report
/// Author: Sanoj
/// Since: 23-Sep-2018
[TearDown]
public void AfterTest()
{
try
{
var status = TestContext.CurrentContext.Result.Outcome.Status;
var stacktrace = “” + TestContext.CurrentContext.Result.StackTrace + “”;
var errorMessage = TestContext.CurrentContext.Result.Message;
Status logstatus;
switch (status)
{
case TestStatus.Failed:
logstatus = Status.Fail;
string screenShotPath = Capture(driver, TestContext.CurrentContext.Test.Name);
_test.Log(logstatus, “Test ended with ” + logstatus + ” – ” + errorMessage);
_test.Log(logstatus, “Snapshot below: ” + _test.AddScreenCaptureFromPath(screenShotPath));
break;
case TestStatus.Skipped:
logstatus = Status.Skip;
_test.Log(logstatus, “Test ended with ” + logstatus);
break;
default:
logstatus = Status.Pass;
_test.Log(logstatus, “Test ended with ” + logstatus);
break;
}
}
catch (Exception e)
{
throw (e);
}
}

///To flush extent report
///To quit driver instance
/// /// Author: Sanoj
/// Since: 23-Sep-2018
[OneTimeTearDown]
public void AfterClass()
{
try
{
_extent.Flush();
}
catch (Exception e)
{
throw (e);
}
driver.Quit();
}

/// To capture the screenshot for extent report and return actual file path
/// Author: Sanoj
/// Since: 23-Sep-2018
private string Capture(IWebDriver driver, string screenShotName)
{
string localpath = “”;
try
{
Thread.Sleep(4000);
ITakesScreenshot ts = (ITakesScreenshot)driver;
Screenshot screenshot = ts.GetScreenshot();
string pth = System.Reflection.Assembly.GetCallingAssembly().CodeBase;
var dir = AppDomain.CurrentDomain.BaseDirectory.Replace(“\\bin\\Debug”, “”);
DirectoryInfo di = Directory.CreateDirectory(dir + “\\Defect_Screenshots\\”);
string finalpth = pth.Substring(0, pth.LastIndexOf(“bin”)) + “\\Defect_Screenshots\\” + screenShotName + “.png”;
localpath = new Uri(finalpth).LocalPath;
screenshot.SaveAsFile(localpath);
}
catch (Exception e)
{
throw (e);
}
return localpath;
}
}
}

Code Explanation:

  • Imported two classes ExtentReports and ExtentTest.
    • ExtentReportsBy using this class we set the path where our reports need to generate.
    • ExtentTestBy using this class we could generate the logs in the report.
  • Took two methods with [Test] annotation such as PassTest and FailTest and method BeforeClass with [OneTimeSetUp] annotation, BeforeTest with [SetUp] annotation, another method AfterTest with [TearDown] annotation and finally, AfterClass with [OneTimeTearDown] annotation.
  • Here my intention is to generate a report with all the two types of results such as Pass and Fail.
  • Used object of ExtentReports class (i.e., _extent) in the BeforeClass which was assigned to [OneTimeSetUp] annotation to generate the HTML report in the required path.
  • Used object of ExtentTest class (i.e., _test) in BeforeTest to get the name of currently executing test case. Also, _test object used in AfterTest method which was assigned to [TearDown] annotation to write logs in the report.
  • Used TestStatus class in the [TearDown] to describe the result of a test.

     Refresh the project after execution. You could find an HTML file named “Automation_Report.html” in “Test_Execution_Reports” folder. Copy the location of the “Automation_Report.html” file and open it by using any browser. You could see beautiful high rich HTML reports as shown below.

Capturee

Capture

Try to practice this report in your Automation scripts which planning to develop using C# and NUnit.

make it perfect !

 

Extent Reports in Automation – TestNG

maxresdefault

     TestNG itself, providing an HTML report in test-output folder. I had a thought of building custom report for automation, after that I built one PDF customized report using iText PDF Java library and took more effort to build it. Later I thought to build a custom beautiful high rich HTML reports with minimum effort; that time Extent Report comes into my mind. Here, I would like to share the details on the integration and implementation of Extent Report utility in Automation test classes that built with TestNG.

Prerequisites to Generate Extent Reports:

  1. Java should be installed and setup Java
  2. TestNG maven dependency should be available
  3. Selenium maven dependency should be available
  4. Extent Report Maven dependency should be available
  5. extent-config.xml – It allows to configure HTML Report

Steps To Generate Extent Reports:

  1. Firstly, create a maven project.
  2. Add TestNG dependency to pom.xml of project in eclipse.
  3. Add selenium-java and selenium-server dependencies to pom.xml of  project in eclipse
  4. Extent Report Maven dependency (version: 2.41.2) should available and added in pom.xml project in eclipse.
  5. Create a java class say ‘SeleniumExtentReport’ and add following code to it,

package com.journeyofquality.test;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.ITestResult;
import org.testng.SkipException;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
import com.relevantcodes.extentreports.ExtentReports;
import com.relevantcodes.extentreports.ExtentTest;
import com.relevantcodes.extentreports.LogStatus;

public class SeleniumExtentReport {
ExtentReports extentReport;
ExtentTest extentTest;
WebDriver driver;

@BeforeSuite
public void beforeSuite() {
//In before suite we are creating HTML report template, adding basic information to it and load the extent-config.xml file

extentReport = new ExtentReports(System.getProperty(“user.dir”) + “/test-output/SeleniumExtentReport.html”,
true);
extentReport.addSystemInfo(“Host Name”, “JourneyofQuality”).addSystemInfo(“Environment”, “Automation Testing”)
.addSystemInfo(“User Name”, “Sanoj”);
extentReport.loadConfig(new File(System.getProperty(“user.dir”) + “\\extent-config.xml”));
}

@BeforeClass
public void beforeClass() {
System.setProperty(“webdriver.chrome.driver”, );
driver = new ChromeDriver();
}

@BeforeMethod
public void beforeMethod(Method method) {
//In before method we are collecting the current running test case name
String className = this.getClass().getSimpleName();
extentTest = extentReport.startTest(className + “-” + method.getName());
}

@Test
public void passTest() {
Assert.assertTrue(true);
}

@Test
public void failTest() {
driver.get(“http://google.com&#8221;);
Assert.assertEquals(driver.getTitle().toString(), “Journey”);
}

@Test
public void skipTest() {
throw new SkipException(“Skipping – This is not ready for testing “);
}

@AfterMethod
public void getResult(ITestResult result, Method method) throws Exception {
//In after method we are collecting the test execution status and based on that the information writing to HTML report
if (result.getStatus() == ITestResult.FAILURE) {
extentTest.log(LogStatus.FAIL, “Test Case Failed is ” + result.getName());
String screenshotPath = SeleniumExtentReport.capture(driver, result.getName());
extentTest.log(LogStatus.FAIL, “Error Details :- \n” + result.getThrowable().getMessage()
+ extentTest.addScreenCapture(screenshotPath));
}
if (result.getStatus() == ITestResult.SKIP) {
extentTest.log(LogStatus.SKIP, “Test Case Skipped is ” + result.getName());
}
if (result.getStatus() == ITestResult.SUCCESS) {
extentTest.log(LogStatus.PASS, “Test Case Passed is ” + result.getName());
}
}

@AfterSuite
public void endReport() {
//In after suite stopping the object of ExtentReports and ExtentTest
extentReport.endTest(extentTest);
extentReport.flush();
driver.quit();
}

/**

* To Capture the Screenshot and return the file path to extent report fail
* cases
*
* @param driver
* @param screenShotName
* @return
* @throws IOException
*/
private static String capture(WebDriver driver, String screenShotName) throws IOException {
String dest = null;
try {
SimpleDateFormat dateFormat = new SimpleDateFormat(“dd-mm-yyyy h-m-s”);
Date date = new Date();
TakesScreenshot ts = (TakesScreenshot) driver;
File source = ts.getScreenshotAs(OutputType.FILE);
dest = System.getProperty(“user.dir”) + “\\ErrorScreenshots\\” + screenShotName + dateFormat.format(date)
+ “.png”;
File destination = new File(dest);
FileUtils.copyFile(source, destination);
} catch (Exception e) {
e.getMessage();
System.out.println(e.getMessage());
}
return dest;
}
}

Code Explanation:

  • Imported two classes ExtentReports and ExtentTest.
    • ExtentReportsBy using this class we set the path where our reports need to generate.
    • ExtentTestBy using this class we could generate the logs in the report.
  • Took three methods with @Test annotation such as passTest, failTest and skipTest and a method beforeSuite with @BeforeSuite annotation, beforeMethod with @BeforeMetod annotation, another method getResult with @AfterMethod annotation and finally, endReport with @AfterSuite annotation.
  • Here my intention is to generate a report with all the three types of results such as Pass, Fail and Skip.
  • Used object of ExtentReports class (i.e., extentReport) in the beforeSuite method which was assigned to @BeforeSuite annotation to generate the HTML report in the required path.
  • Used object of ExtentTest class (i.e., extentTest) in beforeMethod to get the name of currently executing test case. Also, extentTest object used in getResult method which was assigned to @AfterMethod annotation to write logs in the report.
  • Used ITestResult class in the @AfterMethod to describe the result of a test.

extent-config.xml: 

     By using this external XML file (extent-config.xml), we could change the details such as Report Theme (either standard or dark), Report Title, Document Title etc., We use extent object and use loadConfig() method to load this XML file.

<?xml version=”1.0″ encoding=”UTF-8″?>
<extentreports>
<configuration>
<!– report theme –>
<!– standard, dark –>
<theme>standard</theme>
<!– document encoding –>
<!– defaults to UTF-8 –>
<encoding>UTF-8</encoding>
<!– protocol for script and stylesheets –>
<!– defaults to https –>
<protocol>https</protocol>
<!– title of the document –>
<documentTitle>JourneyOfQuality</documentTitle>
<!– report name – displayed at top-nav –>
<reportName>JourneyOfQuality</reportName>
<!– report headline – displayed at top-nav, after reportHeadline –>
<reportHeadline>Automation Report</reportHeadline>
<!– global date format override –>
<!– defaults to yyyy-MM-dd –>
<dateFormat>yyyy-MM-dd</dateFormat>
<!– global time format override –>
<!– defaults to HH:mm:ss –>
<timeFormat>HH:mm:ss</timeFormat>
<!– default style override –>
<theme></theme>
<!– custom javascript –>
<scripts>
<![CDATA[
$(document).ready(function() {
$(“.logo-content”).hide();
$(“.logo-container”).html(“JourneyOfQuality”);
$(‘#parentNodes’).prop(“checked”, true).click();
$(‘#test-count-setting > div.modal-footer > a’)[0].click();
});
]]>
</scripts>
<!– custom styles –>
<styles>
<![CDATA[
]]>
</styles>
</configuration>
</extentreports>

     Refresh the project after execution of above SeleniumExtentReport.java file. You could find an HTML file named “SeleniumExtentReport.html” in your test-output folder. Copy the location of the “SeleniumExtentReport.html” file and open it by using any browser. You could see beautiful high rich HTML reports as shown below.

Capture

Capture1

Try to implement the above mentioned custom report mechanism in your Selenium – Java -TestNG and enjoy automation.

make it perfect !