As you all know that Extent Report Library plays a major role in the test automation reporting and custom report generation, this article aims to help you in using the latest Extent Report Library 4 Series introduced by AventStack. This is the time to migrate version 3 to 4. Here, you are shown the basic changes in version 4. The first thing is ExtentHtmlReporter class deprecated and introduced ExtentSparkReporter in Extent report library 4.
Major Changes in Extent Report 4
Following are the major changes in Extent Report 4 when compared to Extent Report 3:
- ChartLocation is no longer available and can be removed from your set-up code. Suggested fix is the removal of ChartLocaton.
- EmailTemplate has moved from package aventstack.extentreports.reporter to com.aventstack.extentreports.reporter.configuration. Suggested fix is to re-import package.
Advantages of Extent Reports
- Customizable HTML report with step-wise and pie chart representation.
- Displays the time taken for test case execution within the report.
- Each test step can be associated with a screenshot.
- Can be easily integrated with TestNG, JUnit and Cucumber frameworks.
- Multiple test case runs within a single suite can be tracked easily.
New Features in Extent Report 4
- Support for Asterisk (*), BDD/Gherkin.
- Auto-size pre-text area/code size upon click.
- Support for LoggerReporter to navigate from Category/Bug view to Test view.
- Several layout improvements for BDD view.
- Added missing screen capture for steps.
- HtmlReporter, BDD: description to appear as tooltip instead of newline.
- SparkReporter: display ScenarioOutline children as toggles.
- SparkReporter: auto-size text area on a click.
- Category view status toggles.
- Steps count in dashboard displays 0 even though there are logged steps.
- Clean-up tag view naming.
Actual Migration Fact and Changes
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 configures the default style for the HTML report but you have to specify the directory path to store HTML report before starting the test suite. You 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, you have to flush the object of ExtentReports class. The object of ExtentTest class helps to keep track of the status of each test case in the HTML report, with specific color assigned for the test.
Click here to delve deeper into the pre-requisites to generate Extent Reports in order to understand the migration in a better way.
Test Architect, RapidValue