Showing posts with label Reports. Show all posts
Showing posts with label Reports. Show all posts

September 3, 2015

Generate XSLT reports for Webdriver scripts using ANT build.xml

September 03, 2015 3
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




March 25, 2011

How to Create Reports using JUnit

March 25, 2011 34
Create Reports using JUnit:


After running test scripts in eclipse it would be good if we generate reports. Junit is one the most popular unit testing framework around. 


Below are the steps to generate reports:


1. Right click on project and click on "Export" option




   


2. Expand "General" node and select "Ant Buildfiles", click on "Next" button




3. Select the project (let all default options), 
Junit output Directory ... F:\Automation\First\junit  
click on "Finish" button




4. build.xml file should be created under project folder




5.  Now we need to add junit jar and Tools.jar file in Ant's "Global Entires"




6. Select "Window" menu, click on "Preferences"





7. In "Preferences" window, expand "Ant" root node, click on "Runtime"





8. Click on "Classpath" tab, expand "Global Entires" 





9. Click on "Add External JARs" button



10. Navigate to your "eclipse" directory (where eclipse is installed). Select "plugins ->org.junit_3.8.2.v3_8_2_v20100427-1100" directory. Select junit.jar file. and add Tools.jar which is located under java/JDK/Lib

11. Now right click on build.xml file and select Run As -> Ant Build.."





12. In "Edit Configuration and launch" window, select "build", "tootltip (the script we want to run)" and "junitreprot" checkboxes and click on "Run" button









13. All your test scripts will run and finally report will be generated under the same project directory under "junit" folder. To view JUint folder please refresh.




14. Click on "index.html", you will see the report 



Hope you all enjoy this post.





February 11, 2011

Create Reports Using TestNG

February 11, 2011 6


Creating Report.....It is easy with TestNG...it will create default reports....in HTML format.


The Default feature in TestNG is it will create reports automatically..you need not to write any code...

Just run the Script with TestNG...it will automatically create a report...

First Setup the TestNg
Please go through link if you dont know how to set up...

Setting up Selenium RC & TestNG using Eclipse


Observe the screen shot before running the test...


Before Running the Test


Run the script --Run as -->TestNG --see the below screen shot...Report is generated.










Screen Shot after running the Test

After Running the Test


NOTE: You need to download the testng-5.14.10.jar file................it should be in your referenced library..

Hope it will be helpful .......