ANT Build.xml file for test NG project | Selenium Forum
M
Posted on 25/12/2016
I could see the following targets in build.xml file. Can someone explain what is the need of below targets in Build.xml ? What will happen if I dont provide these target when I build my project using ANT.

[b:1ueh13e3] <target name="setClassPath" unless="test.classpath">[/b:1ueh13e3]
<path id="classpath_jars">
<fileset dir="${ws.jars}" includes="*.jar"/>
</path>
<pathconvert pathsep=":"
property="test.classpath"
refid="classpath_jars"/>
</target>

[b:1ueh13e3] <target name="init" depends="setClassPath">[/b:1ueh13e3]
<tstamp>
<format property="start.time" pattern="MM/dd/yyyy hh:mm aa" />
</tstamp>
<condition property="ANT"
value="${env.ANT_HOME}/bin/ant.bat"
else="${env.ANT_HOME}/bin/ant">
<os family="windows" />
</condition>
<taskdef name="testng" classpath="${test.classpath}"
classname="org.testng.TestNGAntTask" />

M
Replied on 25/12/2016

as the name suggest [color=#FF0000:pjajygd6]init [/color:pjajygd6]is for initiation and [color=#FF0000:pjajygd6]setClassPath [/color:pjajygd6]is for locating and loading all the jar files.


M
Replied on 25/12/2016

Thanks for the quick reply. Could you please explain me why we included the below statements in these targets ??

<pathconvert pathsep=":"
property="test.classpath"
refid="classpath_jars"/>


<target name="init" depends="setClassPath">
<tstamp>
<format property="start.time" pattern="MM/dd/yyyy hh:mm aa" />
</tstamp>
<condition property="ANT"
value="${env.ANT_HOME}/bin/ant.bat"
else="${env.ANT_HOME}/bin/ant">
<os family="windows" />
</condition>

Thanks in advance,
Purnachand


M
Replied on 26/12/2016

Anyone could you please reply to my question??


M
Replied on 26/12/2016

read this, it is a very good resource.

http://www.guru99.com/using-apache-ant-with-selenium.html