Introduction
Selenium is the leading open source solution for web test automation. As it is only a driver, it does not have any built-in features for test reporting. Test reporting being a crucial element of test automation framework, the lack of this key functionality will hinder the option of tracking the information and communication with others on the team. Even though, Selenium doesn’t support report generation, but it’s easy enough to do with the right tools. As Selenium provides client APIs for multiple languages such as Java, C#, Python, Ruby, and many more, it is essential to choose the best reporting tool for Selenium that meets the preferred programming language requirements and also fulfills your criteria. Selenium test result reports should carry all the relevant information so that the team members and managers can measure the reports’ progress.
Selenium can be seen using different Selenium reporting tools. Some of the Selenium reporting tools are as follows.
-
TestNG
TestNG is a popular open source unit testing framework inspired by JUnit and NUnit. It comes with a library with a default reporting feature that can be used to generate test reports and can be stored in a designated folder. Apart from the basic level reports, it also provides an option to generate detailed reports. The file index.html that is generated without any manual involvement carries the entire report, along with information on errors, tests executed, the status of test scenarios, and more. When TestNG is used with IDE’s like Eclipse or IntelliJ IDEA, TestNG can create emailable-report.html that shows the scores of each test scenario that can be embedded and shared without any hassle.
Pros:
-
- No additional installation needed, as the reporting feature comes default with the TestNG framework
- Creates HTML reports
- Best reporting tool for Selenium and Java combination and easy to use with CI/CD tool like Jenkins, GitLab CI, and more
Cons:
-
- Supports only Java
- Only available with TestNG framework
- Creates only local HTML reports
-
Allure
Allure is an open-source framework that is designed for creating test execution reports that are easy to understand. It is lightweight and allows the user to add parameters, steps, and attachments. Allure is based on standard xUnit results, to which it adds some supplementary data. Report generation in Allure occurs in two steps. Allure provides adapters for widely used test frameworks for Ruby, Python, Scala, Java, PHP, and C#.
Pros:
-
- It has multiple adapters for many testing frameworks
- Generates detailed test reports that give a clear visualization of summary, defects, behaviors (for BDD tests), graphs, and timelines
- Usable as an on-premises solution
- Easy to integrate with popular CI/CD tools like Jenkins, GitLab CI, etc.
- Support for taking screenshots, a feature that helps in UI testing
- Detailed documentation and exhaustive examples with different programming languages
- Allure Plugin System provides a greater level of flexibility to the representation of reports
- Active community on GitHub and platforms like Stack Overflow
Cons:
-
- Plugin solution that does not have its own database, needs to be integrated with Jenkin/TeamCity/Bamboo to turn in to collaborative report
-
Junit
JUnit provides an option as one of the Selenium reporting tools for Java and Selenium. The implementation under @BeforeClass annotation is run before starting any annotation in the class. Hence, pre-execution tasks like opening the HTML report, adding predefined information, and more can be under the @BeforeClass annotation. The implementation under @AfterClass annotation is run once all the tests have been executed. Post execution tasks like adding test case results and closing reports can be under the @AfterClass annotation. Like TestNG, JUnit also gives Selenium test result reports in a very simple and understandable format.
Pros:
-
- It is a popular open-source unit testing tool that is used by Java developers, so JUnit’s reporting feature automatically becomes one of the best reporting tools for Selenium and Java
- The reporting functionality is available by default with the JUnit framework.
- It creates easily understandable local HTML reports
Cons:
-
- Works only with Java and Junit
- Required code implementation to make it work
- Local reports only
-
Extend Reports
Extent Reports is an open-source reporting library used in selenium test automation. Extent reports become the first choice of Selenium Automation Testers, even though Selenium comes with inbuilt reports using frameworks like JUnit and TestNG. The major difference between the reports provided by JUnit and Extent library is the readability and clarity of information that is supplemented with pie charts and other visual elements. The Extent Reports Library has provision to add logs, events, screenshots, devices, tags, authors, or any other information that can enhance the report’s information.
Pros:
-
- Extent reports are more customizable than others
- Extent API can produce more interactive reports, a dashboard view, graphical view, capture screenshots at every test step, and e-mailable reports
- It can be easily integrated with frameworks like JUnit, NUnit, & TestNG
- It displays the time taken for test case execution
- Good documentation
Cons:
-
- The community plan does not include CI/CD integration
- Support only Java and C#
- The community plan has a limited dashboard that does not include: Errors able, Tags table, Author filter, Device filter
-
ReportNG
ReportNG is a simple HTML reporting plugin that is developed for the TestNG framework. It can be used in place of the default TestNG HTML report. ReportNG uses a color-coding mechanism in the test reports, making the report easy to understand at a single glance. ReportNG generates 100% valid XHTML 1.0 files. The output can be customized by over-riding the default stylesheet with your own CSS file.
Pros:
-
- More detailed reporting mechanism than the default HTML reports provided by TestNG framework
- Ease to customize the look and feel using a user-defined CSS file
- Easy to integrate with CI/CD tool like Jenkins
- Inclusion of a second reporter that produces JUnit format XML output from version 0.9.0
Cons:
-
- Only available for the TestNG framework
Use case
At Brainbox, we have developed a Test Automation Framework for end to end application testing of web and mobile android platforms. You can find the details about the framework here https://www.brainbox.consulting/digital/blogs-news/software-testing-blog/brainbox-test-automation-framework/.
In our test automation framework, we included Allure because of its advantages such as open source and greater level of flexibility to the representation of reports. Besides this, the report generated in Allure give a clear visualization of summary, defects, behaviors, graphs, and timelines. Allure also support taking screenshots and can be easily integrated with Jenkins, GitLab etc.
A picture representation of some features embedded in our systems is given below.
Conclusion
In Selenium’s best reporting tools some of them are language-specific, whereas some are specific to the CI/CD tool. The usage of the ideal Selenium reporting tools is essential for any project that involves Selenium automation testing. It helps track the progress of the testing activity and helps in communicating the status to the relevant stakeholders of the project.
Contact us at sales@brainbox.consulting for more information and we would be happy to assist you with testing related services.