Tuesday 30 September 2014

Junit Reports with ANT in Selenium



Junit Reports with ANT

Reports are important part of any project and cucumber provides default reports. Selenium can generate reports in HTML format using Apache ANT integration. Both are open source tools and can be integrated.

For integration of Apache ANT with Junit, you need to follow below steps:
a.    Download Apache ANT on your machine from http://ant.apache.org/
b.    Extract the above zip file and save it on a particular location on your machine.
c.    Now create an environment variable ANT_HOME in system variables. Provide the path where the ANT jars are downloaded and saved.
 


d.    Now check if ANT has been installed successfully by typing ant in command prompt. If you get an error message like below, ANT is successfully installed on your machine.


e.    Go to eclipse and right click on your project and select Export. Select export options as ANT Build Files.
 

f.    Click Next and Now select the project you want to generate build.xml.
 

g.    Now Right click on build.xml and select Run External Tool Configurations.
Browse the project workspace and provide appropriate name for build.xml and click on RUN.
 

Set the Target in the target tabs.
   
Now check the classpath of the project. It should be as shown.
 
 
 
a.    Now ANT will build the entire project and run the junit classes as shown below.

a.    Now ANT will build the entire project and run the junit classes as shown below.