Earlier we have seen ways to rerun the TestNG tests when there are failures due to many exceptions such as 'NoSuchElementException', 'NoSuchWindowException' 'TimeOutException', 'StaleElementReferenceException' or any other failures.
Allure Reporting framework works fine with any test framework like TestNG, JUnit etc. Below example covers the implementation of Allure Reports in Selenium using TestNG, Java and Maven.
Let us first try to understand allure annotations before using them in our selenium example.
@Description("In this cool test we will check cool thing")
These annotations are used in the same way like we use TestNG annotations or JUnit annotations.
Allure is an open-source framework designed to create interactive and comprehensive test report by Yandex QA Team
Each time when we run automation tests, we will have test results to view details about no. of tests passed, failed and failure details etc. And few reports also include test failure screenshots. We have discussed selenium examples on Extent report and testng custom report with screenshots.
As we know, TestNG provides default html reports with basic information like No. of tests passed, failed, skipped and time taken to execute these tests in milliseconds. But you may not find it very helpful as the reports generated by TestNG has very little information.
As we know all know that ExtentReport is an HTML reporting library (open source) which can be integrated with Selenium WebDriver.
In this article, we will teach you how to develop advanced extent reports / integrate Extent Reports with your existing test automation framework.
We assume you have a working knowledge on Selenium,TestNG and Maven.
Let us start now !!!!
Importance of Reporting in a Test Automation Framework :-
Extent Reports are the most popular reporting used with Selenium. As we all know, TestNG generates html reports by default but they are not more readable and interactive, we have to put lots of efforts to make it attractive. TestNG has provided an ability to implement 'IReporter' an interface to customize testng report by users.
Please visit for the updated article customized emailable report along with screenshots which works perfect for newer versions of testNG and tested with testng latest version 6.14.3
This example was using older testng version.
When ever we execute tests with TestNG, it will generate a default html report with basic information.
In this tutorial, we will see taking a screen shot with test name and placing it in a folder by creating a folder with Test Class Name.
As we are taking screen shots on failure, we need to add logic in creating a screen shot and naming it with test name and place it in its test class name respectively.
We can get the test class name using 'result.getInstanceName()'. Test class name looks some thing like "com.pack.sample.HomePage". But we need to create a folder name with test class name i.e 'HomePage'.