TestNG has decent reporting capability in terms of its in-built reports. But for some purpose, they may not be as user friendly as you’d like it to be. ATU Reporter is an open source utility which we can use to generate good looking TestNG reports. In this post, we will explore how we can configure ATU Reporter with Selenium WebDriver.
Before we proceed, let’s clarify that ATU Reporter will be useful to you only if you are using TestNG. It does not depend on Selenium. That means it can be used during unit testing as well.
A bit about ATU Reporter:
It’s an open source utility for TestNG framework. Its TestNG Listeners(ATUReportsListener, ConfigurationListener and MethodListener) can be used to generate customized graphical reports such as Line Chart, Bar Chart and Pie Chart. It is built using JQuery, CSS, HTML and jqPlot charting library.
Now, let’s take a look at how we can configure it with Selenium WebDriver project. Follow below steps for it.
- Download latest version of ATU Reporter.
- Unzip the file which contains JAR files of ATU Reporter and ATU Test Recorder, Java-doc, Properties file and a Sample Project.
- Reference JAR files in your Selenium project.
- Open class file. We need to add ATUReportsListener.class, ConfigurationListener.class and MethodListener.class Listeners to it. Make sure you update your class file with necessary package imports.
- Reference ATU Reporter properties file in your class file with below code.
- Set the driver object to the ATU Reporter. You can modify indexPageDescription value with your choice of description.
- The ATUReports class has four overloaded add methods for logging the step information. Add these four methods using below code.
- After performing all above steps, your class file should be as below.
- Now, open your TestNG XML file and add necessary Listeners.
- That’s it. Now run your project using TestNG. You should be able to see customized graphical TestNG reports at location defined in ATU Reporter’s properties file.
Below is the output of above exercise. It shows TestNG reports in Bar Chart format.
As you can see, ATU Reporter is very useful in generating good looking TestNG reports. Give it a try and let us know if its useful in your case.
Comments
Post a Comment