We all are aware of the importance of maintaining reports for the better tracking of the processes in software testing. There are different techniques available to generate test reports in Selenium WebDriver. It depends on the conscience of the Test automation framework architect to choose the reporting techniques. Today we are going to discuss XSLT reporting in Selenium. It has much importance when you want to extend the TestNG’s default reporting feature.
Before we jump to the XSLT Reporting, I would like to recommend you another awesome article on another technique of report generation in Selenium. Click on the link below to read more on Extent Reporting.
What is XSLT Reporting?
XSLT is basically a transformation language which transforms one XML document into XHTML document which is convenient for any browser to display the test reporting.
XSLT stands for Extensible Stylesheet Language Transformations.
What is required to set up the XSLT Reporting in Selenium Automation framework?
We need to set up an environment in our Automation framework to implement XSLT reporting. So, the pre-requisites are as follows:
- The project must be configured with the ANT build tool
- XSLT Package inside the project folder
- The project must be developed with TestNG
Once you fulfill above pre-requisites then you are ready to implement XSLT reporting in your automation project.
How to set up ANT in the Selenium project?
Let me guide you through the steps to set up ANT in your project by assuming you don’t have ANT configured project set up.
ANT is basically a build tool for Java, which is written in XML. It is mainly used to compile the code.
Step# 1: Download ANT zip file
Click here to download the ANT jar file. Download it from the current release section.
Step# 2: Extraction and set up the ANT file
Once you extracted the zip file then set up its path.
Right click on My Computer then click Properties and click on Advanced system settings.
Step# 3: Environment variable set up
Now set up environment variable so click on Environment Variables. Click on New then enter the Variable name and Variable value as the path of Ant folder till bin.
Step# 4: System variable set up
Now set up System variable. Click on New and add the path till bin.
Step# 5: Validate Build on CMD
Open CMD and type command- ant.
You will get Build Failed status since no build generated yet.
This is all about ANT build set up.
How to configure XSLT Reporting in Automation project?
Now it’s time to configure XSLT reporting. Follow the below Steps.
Step# 1: Download XSLT file
Click here to download the XSLT file.
Step# 2: Extract and store file in your project
Got to the directory of your project then store the extracted XSLT file inside your project folder.
When you refresh your project folder in Eclipse then you will see the XSLT files are added.
How to generate XSLT reporting in Selenium with TestNG?
Now everything is done. We assume you are developing your automation scripts in TestNG. Later we will discuss elaborated tutorials on TestNG.
Run your TestNG program then run the ant build from cmd.
Now you should expect one folder for XSLT reporting in your project directory- testing-xslt.
If that folder didn’t appear then go with the below steps.
How to get ‘testng-xslt’ folder in the project directory for validating report?
Go to your project in Eclipse. Perform right click on build.xml and Run as Ant Build.
A new window appears when you click it. Select Generate Report and click Run.
After the successful run, A Build Successful message will be displayed in Console.
Further, you see the testing-xslt folder added in your project directory.
Open this folder and click on index. Your report will be visible in your browser.
Hope this is clear, not all clear. 😊 Share your thoughts in the comment below and don’t forget to join our Facebook group.