Deepa,
Do following steps
1. Download ReportNG (jar) files (there should be two jar file like a.
testng.jar b. velocity.jar)
2. Include ReportNG jars into your project
3. Download Ant and set your PATH up to the bin folder of ant
directory by following below
a. Download the binary distribution.
b. Unpack the binary distribution in the directory of your choice.
c. Add <where you unpacked the zip file>/apache-ant-1.7.0/bin to
your PATH environment variable.
d. Check that your Ant installation is OK:
$ ant -version
Apache Ant version 1.7.0 compiled on December 13 2006
3. Copy the below code (save it as build.xml) file into root directory
of your project, and change the path of all jar file in the section
showing comments like "<!-- You need the put paths of your own ---->"
based on your project directory structure.
4. Now from Project Explorer window in Eclipse, right click on
Build.xml file and run as 'Ant Build'
5. It should work fine
let me know if still facing some issue.
======================Build.xml===============================
<project name="Projectname" default="run" basedir=".">
<property name="classes.dir" value="${basedir}\bin" />
<property name="src.dir" value="${basedir}\src" />
<property name="report.dir" value="${basedir}\reports" />
<property name="browser" value="C:/Program Files/Mozilla Firefox/
firefox.exe"/>
<!-- You need the put paths of your own ---->
<path id="libs">
<pathelement path="${basedir}\libs\testng-5.9-jdk15.jar"/>
<pathelement path="${basedir}\libs\selenium-java-client-driver.jar"/
>
<pathelement path="${basedir}\libs\selenium-server.jar"/>
<pathelement path="${basedir}\libs\reportng-1.0.jar"/>
<pathelement path="${basedir}\libs\velocity-dep-1.4.jar"/>
<pathelement path="${basedir}\${classes.dir}"/>
</path>
<!-- Start the server -->
<target name="startServer">
<echo>Starting Selenium Server...</echo>
<java jar="${basedir}\libs\selenium-server.jar" fork="true"
spawn="true">
<arg line="-multiwindow -log c:\log.txt"/>
</java>
</target>
<!-- Delete old data and create new directories -->
<target name="init" depends="startServer">
<echo>Initlizing...</echo>
<delete dir="${classes.dir}" />
<mkdir dir="${classes.dir}"/>
<delete dir="${report.dir}" />
<mkdir dir="${report.dir}"/>
</target>
<!-- Complies the java files -->
<echo>Compling...</echo>
<target name="compile" depends="init">
<echo>Compiling...</echo>
<javac debug="true" srcdir="${src.dir}" destdir="${classes.dir}"
classpathref="libs" />
</target>
<!-- Runs the file and generates Reportng report -->
<target name="run" description="Running test" depends="compile">
<echo>Running...</echo>
<taskdef resource="testngtasks" classpathref="libs"/>
<testng outputDir="${report.dir}"
haltonfailure="true"
useDefaultListeners="false"
listeners="org.uncommons.reportng.HTMLReporter"
classpathref="libs">
<classfileset dir="${classes.dir}" includes="**/*.class" />
</testng>
<!-- Open the report in browser.-->
<exec executable="${browser}" spawn="yes">
<arg line="'${report.dir}\html\index.html'" />
</exec>
</target>
</project>
=======================Code End================================
Good luck,