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.
Not able to start server And Batches simultaneously
Hi Narayan
Following is xml file to execute batch suite and start sahi proxy server
Proxy get start But it not able to execute suite file
If i call two target separately using CMD it run fine.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/**
* Copyright 2006 V Narayan Raman
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project name="demo" default="sahitests">
<property name="userdata.dir" value="D:/sahi/userdata"/>
<property name="url" value="meghana:8080/digite-war/Welcome.do"/>
<property name="suite.dir" value="scripts/MyBatch/batch.suite" />
<property name="log.dir" value="MyLog/batch" />
<property name="threadCount" value="5" />
<taskdef name="sahi" classname="net.sf.sahi.ant.RunSahiTask" classpath="lib/ant-sahi.jar"/>
<target name="sahitests" description="start sahi tests">
<antcall target="start"/>
<antcall target="runfftests"/>
</target>
<target name="runfftests" description="start">
<sahi suite="${userdata.dir}/${suite.dir}"
browser="C:\Program Files\Mozilla Firefox\firefox.exe"
baseurl="http://${url}"
sahihost="localhost"
sahiport="9999"
failureproperty="sahi.failed"
haltonfailure="false"
browseroption="-profile ${userdata.dir}/browser/ff/profiles/sahi$threadNo -no-remote"
browserProcessName="firefox.exe"
threads="${threadCount}">
<report type="html" logdir="${userdata.dir}/${log.dir}"/>
<report type="junit" logdir="${userdata.dir}/${log.dir}"/>
</sahi>
<antcall target="stopsahi"/>
<antcall target="failsahi"/>
</target>
<target name="start" description="starts proxy">
<java classname="net.sf.sahi.Proxy" fork="true">
<!--<env key="MOZ_NO_REMOTE" value="1"/>-->
<classpath location="lib/sahi.jar">
<pathelement location="extlib/rhino/js.jar"/>
<pathelement location="extlib/apc/commons-codec-1.3.jar"/>
<fileset dir="extlib" includes="*.jar"/>
</classpath>
<arg value="." id="basePath"/>
<arg value="userdata" id="userdataPath"/>
</java>
</target>
<target name="failsahi" if="sahi.failed">
<!--antcall target="stop-web"/-->
<fail message="Sahi tests failed!"/>
</target>
<target name="stopsahi" description="stop sahi server">
<sahi stop="true" sahihost="localhost" sahiport="9999"/>
</target>
</project>
Following is xml file to execute batch suite and start sahi proxy server
Proxy get start But it not able to execute suite file
If i call two target separately using CMD it run fine.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/**
* Copyright 2006 V Narayan Raman
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project name="demo" default="sahitests">
<property name="userdata.dir" value="D:/sahi/userdata"/>
<property name="url" value="meghana:8080/digite-war/Welcome.do"/>
<property name="suite.dir" value="scripts/MyBatch/batch.suite" />
<property name="log.dir" value="MyLog/batch" />
<property name="threadCount" value="5" />
<taskdef name="sahi" classname="net.sf.sahi.ant.RunSahiTask" classpath="lib/ant-sahi.jar"/>
<target name="sahitests" description="start sahi tests">
<antcall target="start"/>
<antcall target="runfftests"/>
</target>
<target name="runfftests" description="start">
<sahi suite="${userdata.dir}/${suite.dir}"
browser="C:\Program Files\Mozilla Firefox\firefox.exe"
baseurl="http://${url}"
sahihost="localhost"
sahiport="9999"
failureproperty="sahi.failed"
haltonfailure="false"
browseroption="-profile ${userdata.dir}/browser/ff/profiles/sahi$threadNo -no-remote"
browserProcessName="firefox.exe"
threads="${threadCount}">
<report type="html" logdir="${userdata.dir}/${log.dir}"/>
<report type="junit" logdir="${userdata.dir}/${log.dir}"/>
</sahi>
<antcall target="stopsahi"/>
<antcall target="failsahi"/>
</target>
<target name="start" description="starts proxy">
<java classname="net.sf.sahi.Proxy" fork="true">
<!--<env key="MOZ_NO_REMOTE" value="1"/>-->
<classpath location="lib/sahi.jar">
<pathelement location="extlib/rhino/js.jar"/>
<pathelement location="extlib/apc/commons-codec-1.3.jar"/>
<fileset dir="extlib" includes="*.jar"/>
</classpath>
<arg value="." id="basePath"/>
<arg value="userdata" id="userdataPath"/>
</java>
</target>
<target name="failsahi" if="sahi.failed">
<!--antcall target="stop-web"/-->
<fail message="Sahi tests failed!"/>
</target>
<target name="stopsahi" description="stop sahi server">
<sahi stop="true" sahihost="localhost" sahiport="9999"/>
</target>
</project>
Comments
It is not very clear what your problem is. Guessing from the xml you have attached, it seems like you are starting the proxy and then invoking runfftests, but since the proxy process does not exit, it never goes on to run the ff tests.
You will need to start the proxy as a parallel task. Have a look at sahi/batch_runners/ant/sample.xml to see how to configure the parallel task.
Regards,
Narayan