18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Ant script failing. Not able to execute xml file
When I try to execute this file from command prompt, I am getting an error like this
Can anyone help me to resolve this issue?
Buildfile: C:\MyWorks\4PFsahi\build.xml
runfftests:
startsahi:
[sahi]
[sahi] suiteName = C:\MyWorks\4PFsahi/Scripts/Suites/ukSmokeTest.suite
[sahi] base = http://www.google.com/
[sahi] sahiHost = localhost
[sahi] port = 9999
[sahi] threads = 3
[sahi] browser = /Program Files/Internet Explorer/
[sahi] browserOption = null
[sahi] browserProcessName = iexplore.exe
[sahi] this.isSingleSession == false
[sahi] Added shutdown hook.
[sahi] http://localhost:9999/_s_/dyn/Suite_start?suite=C:\MyWorks\4PFsahi/Scripts/Suites/ukSmokeTest.suite&base=http://www.google.com/&threads=3&sahisid=sahi_af19ab4b0460b049f
b0b21d0e821b0b08535&browser=%2FProgram+Files%2FInternet+Explorer%2F&browserProcessName=iexplore.exe&html=
[sahi] STATUS:FAILURE
stopsahi:
failsahi:
BUILD FAILED
C:\MyWorks\4PFsahi\build.xml:25: The following error occurred while executing this line:
C:\MyWorks\4PFsahi\build.xml:28: Sahi tests failed!
Total time: 17 seconds
Shutting down ...
This is the XML file used:
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="bids" default="runfftests">
<property environment="env"/>
<property name="sahi.home" value="${env.SAHI_HOME}" location="C:/sahi/" />
<property name="user.data" value="${env.SAHI_USERDATA_DIR}" location="C:/MyWorks/4PFsahi/" />
<property name="urlbase" value="http://www.google.com/"/>
<taskdef name="sahi" classname="net.sf.sahi.ant.RunSahiTask" classpath="${sahi.home}/lib/ant-sahi.jar"/>
<target name="runfftests">
<antcall target="startsahi"/>
<sleep seconds="4"/>
<sahi suite="${user.data}/Scripts/Suites/ukSmokeTest.suite"
browser="/Program Files/Internet Explorer/"
baseurl="${urlbase}"
sahihost="localhost"
sahiport="9999"
failureproperty="sahi.failed"
haltonfailure="false"
browserProcessName="iexplore.exe"
threads="3">
</sahi>
<sleep seconds="4"/>
<antcall target="stopsahi"/>
<sleep seconds="4"/>
<antcall target="failsahi"/>
</target>
<target name="failsahi" if="sahi.failed">
<fail message="Sahi tests failed!"/>
</target>
<target name="startsahi" description="start sahi proxy">
<java classname="net.sf.sahi.Proxy" fork="true" spawn="true" dir="${sahi.home}">
<!--<env key="MOZ_NO_REMOTE" value="1"/>-->
<classpath location="${sahi.home}/lib/sahi.jar">
<fileset dir="${sahi.home}/extlib" includes="**/*.jar"/>
</classpath>
<arg value="${sahi.home}" id="basePath"/>
<arg value="${user.data}" id="userdataPath"/>
</java>
</target>
<target name="stopsahi" description="stop sahi server">
<sahi stop="true" sahihost="localhost" sahiport="9999"/>
</target>
</project>
Can anyone help me to resolve this issue?
Buildfile: C:\MyWorks\4PFsahi\build.xml
runfftests:
startsahi:
[sahi]
[sahi] suiteName = C:\MyWorks\4PFsahi/Scripts/Suites/ukSmokeTest.suite
[sahi] base = http://www.google.com/
[sahi] sahiHost = localhost
[sahi] port = 9999
[sahi] threads = 3
[sahi] browser = /Program Files/Internet Explorer/
[sahi] browserOption = null
[sahi] browserProcessName = iexplore.exe
[sahi] this.isSingleSession == false
[sahi] Added shutdown hook.
[sahi] http://localhost:9999/_s_/dyn/Suite_start?suite=C:\MyWorks\4PFsahi/Scripts/Suites/ukSmokeTest.suite&base=http://www.google.com/&threads=3&sahisid=sahi_af19ab4b0460b049f
b0b21d0e821b0b08535&browser=%2FProgram+Files%2FInternet+Explorer%2F&browserProcessName=iexplore.exe&html=
[sahi] STATUS:FAILURE
stopsahi:
failsahi:
BUILD FAILED
C:\MyWorks\4PFsahi\build.xml:25: The following error occurred while executing this line:
C:\MyWorks\4PFsahi\build.xml:28: Sahi tests failed!
Total time: 17 seconds
Shutting down ...
This is the XML file used:
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="bids" default="runfftests">
<property environment="env"/>
<property name="sahi.home" value="${env.SAHI_HOME}" location="C:/sahi/" />
<property name="user.data" value="${env.SAHI_USERDATA_DIR}" location="C:/MyWorks/4PFsahi/" />
<property name="urlbase" value="http://www.google.com/"/>
<taskdef name="sahi" classname="net.sf.sahi.ant.RunSahiTask" classpath="${sahi.home}/lib/ant-sahi.jar"/>
<target name="runfftests">
<antcall target="startsahi"/>
<sleep seconds="4"/>
<sahi suite="${user.data}/Scripts/Suites/ukSmokeTest.suite"
browser="/Program Files/Internet Explorer/"
baseurl="${urlbase}"
sahihost="localhost"
sahiport="9999"
failureproperty="sahi.failed"
haltonfailure="false"
browserProcessName="iexplore.exe"
threads="3">
</sahi>
<sleep seconds="4"/>
<antcall target="stopsahi"/>
<sleep seconds="4"/>
<antcall target="failsahi"/>
</target>
<target name="failsahi" if="sahi.failed">
<fail message="Sahi tests failed!"/>
</target>
<target name="startsahi" description="start sahi proxy">
<java classname="net.sf.sahi.Proxy" fork="true" spawn="true" dir="${sahi.home}">
<!--<env key="MOZ_NO_REMOTE" value="1"/>-->
<classpath location="${sahi.home}/lib/sahi.jar">
<fileset dir="${sahi.home}/extlib" includes="**/*.jar"/>
</classpath>
<arg value="${sahi.home}" id="basePath"/>
<arg value="${user.data}" id="userdataPath"/>
</java>
</target>
<target name="stopsahi" description="stop sahi server">
<sahi stop="true" sahihost="localhost" sahiport="9999"/>
</target>
</project>
This discussion has been closed.
Comments
In your ant target, browser should point to full exe path (/Program Files/Internet Explorer/iexplore.exe). You also need a browserOption for ie8 and ie9. Look at http://sahi.co.in/w/Running+multiple+tests+in+batch+mode+V3.0 for the older syntax.
The newer syntax uses browserType http://sahi.co.in/w/Running+multiple+tests+in+batch+mode
Instead of using
Use
Regards,
Narayan