Hi all, in this article I will describe how to integrate ExtentReports reporting tool with TestNG Listeners. I described how to use TestNG Listeners in this article and Canberk Akduygu and I also described how to rerun failed tests with IRetryAnalyzer in this article. Here, I will use TestNG listeners and IRetryAnalyzer interface and add ExtentReports classes to generate very beautiful reports after each test run. At the end of this article, I will share this project GitHub link as well. 😉

If you do not know Page Object Model, before starting this article, I suggest you check my POM with JAVA article. In our Page Object Model example, we create two login tests for n11.com website. Now, I will add ExtentReports and Listener packages under test package as shown below.

Let’s start step by step! 🙂

Page Classes

BasePage Class: