6.2 Ant Build XSLT.xml
<project name="ANT_with_TestNGXslt" default="run" basedir=".">
<property name="classes.dir" value="bin" />
<property name="src.dir" value="src" />
<property name="log4j.dir" value="log4j" />
<property name="suite.dir" value="TestSuite" />
<property name="report.dir" value="test-output" />
<property name="lib.dir" value="Libraries" />
<path id="build.class.path">
<pathelement location="${log4j.dir}" />
<pathelement location="${classes.dir}" />
<!- You can call either this way if you are sure of the jar files
<pathelement location="${lib.dir}/testng-6.8.jar" />
<pathelement location="${lib.dir}/selenium-server-standalone-2.25.0.jar" />
<pathelement location="${lib.dir}/saxon-8.7.jar" />
<pathelement location="${lib.dir}/SaxonLiaison.jar" />
<pathelement location="${lib.dir}/log4j-1.2.17.jar" />
<pathelement location="${lib.dir}/selenium-java-2.25.0.jar" />
<pathelement location="${lib.dir}/poi/dom4j-1.6.1.jar" />
<pathelement location="${lib.dir}/poi/poi-3.9-20121203.jar" />
<pathelement location="${lib.dir}/poi/poi-ooxml-3.9-20121203.jar" />
<pathelement location="${lib.dir}/poi/poi-ooxml-schemas-3.9-20121203.jar" />
<pathelement location="${lib.dir}/poi/stax-api-1.0.1.jar" />
<pathelement location="${lib.dir}/poi/xmlbeans-2.3.0.jar" /> -->
</path>
<target name="run">
<!--<antcall target="startSeleniumServer" />-->
<antcall target="clean" />
<antcall target="compile" />
<antcall target="runTests" />
<!--<antcall target="stopSeleniumServer" />-->
</target>
<!-- Start the server -->
<target name="startSeleniumServer">
<echo>Starting Selenium Server...</echo>
<java jar="${lib.dir}selenium-server-standalone-2.25.0.jar" fork="true" spawn="true">
<arg line="-singlewindow -log ${logs.dir}selenium_server_log.txt" />
</java>
</target>
<!-- Delete old data and create new directories -->
<target name="clean">
<echo>Initlizing...</echo>
<delete dir="${classes.dir}" />
<mkdir dir="${classes.dir}" />
<delete dir="${report.dir}" />
<mkdir dir="${report.dir}" />
</target>
<!-- Compiles the java files -->
<target name="compile">
<echo>Compiling...</echo>
<javac debug="true" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="build.class.path" includeantruntime="false" includes="**/**" />
<javac debug="true" srcdir="${suite.dir}" destdir="${classes.dir}" classpathref="build.class.path" includeantruntime="false" includes="**/**" />
<copy todir="${classes.dir}">
<fileset dir="${src.dir}" excludes="**/*.java" />
</copy>
</target>
<!-- Runs the file and generate report -->
<target name="runTests" description="Running tests">
<echo>Running Tests...</echo>
<taskdef name="testng" classname="org.testng.TestNGAntTask" classpathref="build.class.path" />
<testng outputdir="${report.dir}" classpathref="build.class.path" workingdir="${basedir}">
<xmlfileset dir="${basedir}" includes="suite.xml" />
</testng>
</target>
<!-- Stop the selenium Server -->
<target name="stopSeleniumServer">
<echo> Trying to stop selenium server ... </echo>
<get taskname="selenium-shutdown" src="http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer" dest="${logs.dir}selenium_server_shutdown_result.txt" ignoreerrors="true" />
<echo taskname="selenium-shutdown" message="Shutdown complete.." />
</target>
</project>Last updated