XSLT Reporting in Selenium Automation Framework with TestNG

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.

How to generate Extent Reports in Selenium Automation Framework?

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:

  1. The project must be configured with the ANT build tool
  2. XSLT Package inside the project folder
  3. 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.

Current release ANT

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.

Environment Variables

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.

New path

Step# 4: System variable set up

Now set up System variable. Click on New and add the path till bin.

New path

Step# 5: Validate Build on CMD

Open CMD and type command- ant.

You will get Build Failed status since no build generated yet.

Ant cmd

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.

project folder

When you refresh your project folder in Eclipse then you will see the XSLT files are added.

Project Hierarchy with XSLT

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.

Ant build from eclipse

A new window appears when you click it. Select Generate Report and click Run.

Generate XSLT Reporting report

After the successful run, A Build Successful message will be displayed in Console.

Build result console

Further, you see the testing-xslt folder added in your project directory.

testnf-xslt folder

Open this folder and click on index. Your report will be visible in your browser.



XSLT Reporting

Hope this is clear, not all clear. 😊 Share your thoughts in the comment below and don’t forget to join our Facebook group.

Join Inviul fb group

Leave a Reply