How to Leverage Extent Reporting

Arvind Choudhary
3 min readJul 18, 2022

In previous article, we spoke about bare minimum to getting started with how to use extent reporting whereas in this article I would show you how to achieve best out of extent report rather than just using it at bare minimum.

Previous Article: TestNG testing framework — Extent Report

What extra can we do to achieve an more detailed report?

With Extent Report library we can add below details to our test cases:

  1. User — you can assign each testcase with an user, which you could use to identify who is the author of that particular test case.
  2. Category — category of your test cases.
  3. Device — On which device did you execute that particular test case, you can pass any string value(browser/OS name).In this example I gave Win.
  4. Attachment — you can attach screenshot to test case.(refer to last snapshot).

Lets dig into how to leverage these properties of extent reporting.

I’ve added this project to GitHub, you can clone the same to go though code(link shared at the bottom of article).

pom.xml

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.6.0</version>
</dependency>
<!-- Extent Report -->
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>5.0.9</version>
</dependency>

Code:

TestNG runner file

Extent Report (snapshots):

Default view:

TC list— (1st Option on left panel)

Category View — .assignCategory() method

Categories — (2nd Option on left panel) — refer to code on line no. 59

Device View — .assignDevice() method

Devices— (3rd Option on left panel) — — refer to code on line no. 69

User View — .assignAuthor() method

Users — (4th Option on left panel) — refer to code on line no. 49

Default Summary

Summary Page — (last Option)
Summary Page — (last Option)

Test Case with Attachmate — .addScreenCaptureFromPath() method

TC with attachment. refer to code on line no. 111

GitHub repository:

  1. Extent Reporting Example: Arvind142/ExtentReporting_Example (github.com) — Code shown in this article.
  2. Modular Automation Framework: Arvind142/TestNG-Modular-Automation-Framework (github.com) — Proper Implementation of extent reporting with ITestListener.

I hope these links and article help you learn more of extent reporting.

--

--