September 3, 2015

Generate XSLT reports for Webdriver scripts using ANT build.xml

This is continuation of my previous post Ant-with-selenium-webdriver-and-testng.html 

In previous post i explained how to integrate ant with selenium and testNG. In this post i will explain how to Generate XSLT reports using Ant.

Need of  XSLT reports:

Till now we are relying on reports generated by testNG. But those reports are not much interactive. XSLT reports are very interactive and easy to understand. Below is sample report.



Steps to Configure XSLT reports:

Prerequisites:
1. SeleniumWebdriver Project developed using ANT. If you want you can download it from here.

Ant_SeleniumWebdriver_TestNG

2. Download XSLT from here Download XSLT

Configure XSLT:


  1. Download testng-xslt-1.1.2-master.zip and unzip it 
  2. Copy all jar files and place them in jar library folder in your project.
  3. Copy the testng-results.xsl from the testng-xslt folder(path: XSLT jartestng-xslt-1.1.2-mastertestng-xslt-1.1.2-mastersrcmainresources) and place in your project folder.
  4. Modify xml code in build.xml


Below is updated build.xml file. which has xslt code included.



How to Generate XLST Reports:

To generate XSLT report you need to run build.xml file and need to check the task check box (makexsltreports) then report will be generated under your project with folder Name --- XSLT_Reports---output--index.html

Below is folder path screenshot:

Below is sample report: (PASSED)



Run From Command prompt:

You can run makexsltreports task from comamnd prompt also. Here is the way to run
Navigate to projetc folder from command prompt and type in --- ant  

ant makexsltreports

I updated  code to generate failed report.

Below is failed report:




Click on Test which is under TestNG Results.
Click on Failed test case method name (testTC2()). and click on exception..it will show you details about exception.



You can download project Here ... ANT_Webdriver_TestNG_XSLT




3 comments: