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.
Running Sahi scripts in Parallell
in Sahi Pro
I wish to speed up the time taken for my tests to run, by running my tests in parallel
I have configured 5 instances of my web application running an an instance in the same tomcat server, each with a different port number, communicating with it's own database.
I have split my tests up into 5 suites, so that they run for approximately the same time.
I have a dd.csv for each suite, which contains the suite file name and the url the tests are to be executed against.
Using an ant xml file I have configured the following:
<macrodef name="runSahiInstance">
<attribute name="suiteN"/>
<attribute name="instance"/>
<attribute name="testBaseURL"/>
<attribute name="sahiHost"/>
<attribute name="sahiPort"/>
<sequential>
<sahi suite="@{suiteN}"
browserType="chrome"
baseurl="@{testBaseURL}"
sahihost="@{sahiHost}"
sahiport="@{sahiPort}"
failureproperty="sahi.failed"
haltonfailure="false"
singlesession="false"
tags="@{instance}"
threads="1"
fork="true">
<report type="html" logdir="${sahi.htmlLogDir}\${test.buildNumber}\${current.time}"/>
<report type="junit" logdir="${sahi.junitLogDir}"/>
</sahi>
</sequential>
</macrodef>
<macrodef name="runTestRunner">
<attribute name="suiteN"/>
<attribute name="instance"/>
<attribute name="testBaseURL"/>
<attribute name="buildNumber"/>
<attribute name="currentTime"/>
<sequential>
<exec dir="C:\Program Files\sahiPRO\userdata\bin" executable="C:\Program Files\sahiPRO\userdata\bin\testrunner.bat" spawn="true">
<arg value="@{suiteN}"/>
<arg value="%%@{testBaseURL}%%;"/>
<arg value="chrome"/>
<arg value="@{instance}" id="tags"/>
<arg value="@{buildNumber}" id="buildNumber"/>
<arg value="@{currentTime}" id="currentTime"/>
</exec>
</sequential>
</macrodef>
<target name="sahiRunChromeTests" description="start the server and run sahi tests Chrome" if="isBrowserChrome">
<parallel>
<antcall target="start-sahi"/>
<sequential>
<!-- IMPORTANT: NEED TO WAIT AT LEAST 30 SECS, ELSE SAHI WON'T RUN CORRECTLY IF WE ATTEMPT TO
LAUNCH A SECOND SET OF TESTS (OR EVENT THE FIRST SET, IF RUNNING FROM JENKINS).
THIS VALUE MAY NEED TO INCREASED FURTHER ON SLOWER MACHINES. -->
<sleep seconds="${sahi.startDelaySecs}"/>
<antcall target="switchToSAHIProxySettings"/>
<waitfor maxwait="10" maxwaitunit="second" checkevery="100">
<http url="${test.baseURL}"/>
</waitfor>
<tstamp>
<format property="current.time" pattern="yyyy-MM-dd_HH-mm-ss"/>
</tstamp>
<echo message="running tests for chrome"/>
<parallel>
<runTestRunner suiteN="IntegrationTests.dd.csv" instance="instance1" testBaseURL="${test.baseURL}" buildNumber="${test.buildNumber}" currentTime="${current.time}" />
<runTestRunner suiteN="IntegrationTests.dd.csv" instance="instance2" testBaseURL="${test.baseURL}" buildNumber="${test.buildNumber}" currentTime="${current.time}" />
<!--
<runTestRunner suiteN="IntegrationTests.dd.csv" instance="instance1" testBaseURL="${test.baseURL}" buildNumber="${test.buildNumber}" />
<runSahiInstance suiteN="${suiteName}" instance="instance1" testBaseURL="${test.baseURL}" sahiHost="${sahi.host}" sahiPort="${sahi.port}" />
<runSahiInstance suiteN="${suiteName}" instance="instance2" testBaseURL="${test.baseURL}" sahiHost="${sahi.host}" sahiPort="${sahi.port}" />
<runSahiInstance suiteN="${suiteName}" instance="instance3" testBaseURL="${test.baseURL}" sahiHost="${sahi.host}" sahiPort="${sahi.port}" />
<runSahiInstance suiteN="${suiteName}" instance="instance4" testBaseURL="${test.baseURL}" sahiHost="${sahi.host}" sahiPort="${sahi.port}" />
<runSahiInstance suiteN="${suiteName}" instance="instance5" testBaseURL="${test.baseURL}" sahiHost="${sahi.host}" sahiPort="${sahi.port}" />
-->
</parallel>
<!--sleep seconds="4"/-->
<!--antcall target="check-sahi-status"/-->
</sequential>
</parallel>
<sleep seconds="4"/>
<echo message="completed tests for chrome"/>
<sleep seconds="4"/>
<antcall target="stop-sahi"/>
</target>
sahiRunChromeTests is called, and I have attempted to run the 5 sets of tests in parallel using testrunner, and sahi directly.
Neither of these are producing the desired results. For testing puroses I have simplified each suite to run a simple test which involves logging into our web based application, and run against 2 out of the 5 configured instances.
I will frequently see one suite of tests running, and the other only giving me a message indicating that Chrome is dead.
On other occassions I will both instances load their respective logon pages, 1 will log in successfully, the second will fail to enter any data into the logon screen.
Any assistance in this matter is greatly appreciated.
I have configured 5 instances of my web application running an an instance in the same tomcat server, each with a different port number, communicating with it's own database.
I have split my tests up into 5 suites, so that they run for approximately the same time.
I have a dd.csv for each suite, which contains the suite file name and the url the tests are to be executed against.
Using an ant xml file I have configured the following:
<macrodef name="runSahiInstance">
<attribute name="suiteN"/>
<attribute name="instance"/>
<attribute name="testBaseURL"/>
<attribute name="sahiHost"/>
<attribute name="sahiPort"/>
<sequential>
<sahi suite="@{suiteN}"
browserType="chrome"
baseurl="@{testBaseURL}"
sahihost="@{sahiHost}"
sahiport="@{sahiPort}"
failureproperty="sahi.failed"
haltonfailure="false"
singlesession="false"
tags="@{instance}"
threads="1"
fork="true">
<report type="html" logdir="${sahi.htmlLogDir}\${test.buildNumber}\${current.time}"/>
<report type="junit" logdir="${sahi.junitLogDir}"/>
</sahi>
</sequential>
</macrodef>
<macrodef name="runTestRunner">
<attribute name="suiteN"/>
<attribute name="instance"/>
<attribute name="testBaseURL"/>
<attribute name="buildNumber"/>
<attribute name="currentTime"/>
<sequential>
<exec dir="C:\Program Files\sahiPRO\userdata\bin" executable="C:\Program Files\sahiPRO\userdata\bin\testrunner.bat" spawn="true">
<arg value="@{suiteN}"/>
<arg value="%%@{testBaseURL}%%;"/>
<arg value="chrome"/>
<arg value="@{instance}" id="tags"/>
<arg value="@{buildNumber}" id="buildNumber"/>
<arg value="@{currentTime}" id="currentTime"/>
</exec>
</sequential>
</macrodef>
<target name="sahiRunChromeTests" description="start the server and run sahi tests Chrome" if="isBrowserChrome">
<parallel>
<antcall target="start-sahi"/>
<sequential>
<!-- IMPORTANT: NEED TO WAIT AT LEAST 30 SECS, ELSE SAHI WON'T RUN CORRECTLY IF WE ATTEMPT TO
LAUNCH A SECOND SET OF TESTS (OR EVENT THE FIRST SET, IF RUNNING FROM JENKINS).
THIS VALUE MAY NEED TO INCREASED FURTHER ON SLOWER MACHINES. -->
<sleep seconds="${sahi.startDelaySecs}"/>
<antcall target="switchToSAHIProxySettings"/>
<waitfor maxwait="10" maxwaitunit="second" checkevery="100">
<http url="${test.baseURL}"/>
</waitfor>
<tstamp>
<format property="current.time" pattern="yyyy-MM-dd_HH-mm-ss"/>
</tstamp>
<echo message="running tests for chrome"/>
<parallel>
<runTestRunner suiteN="IntegrationTests.dd.csv" instance="instance1" testBaseURL="${test.baseURL}" buildNumber="${test.buildNumber}" currentTime="${current.time}" />
<runTestRunner suiteN="IntegrationTests.dd.csv" instance="instance2" testBaseURL="${test.baseURL}" buildNumber="${test.buildNumber}" currentTime="${current.time}" />
<!--
<runTestRunner suiteN="IntegrationTests.dd.csv" instance="instance1" testBaseURL="${test.baseURL}" buildNumber="${test.buildNumber}" />
<runSahiInstance suiteN="${suiteName}" instance="instance1" testBaseURL="${test.baseURL}" sahiHost="${sahi.host}" sahiPort="${sahi.port}" />
<runSahiInstance suiteN="${suiteName}" instance="instance2" testBaseURL="${test.baseURL}" sahiHost="${sahi.host}" sahiPort="${sahi.port}" />
<runSahiInstance suiteN="${suiteName}" instance="instance3" testBaseURL="${test.baseURL}" sahiHost="${sahi.host}" sahiPort="${sahi.port}" />
<runSahiInstance suiteN="${suiteName}" instance="instance4" testBaseURL="${test.baseURL}" sahiHost="${sahi.host}" sahiPort="${sahi.port}" />
<runSahiInstance suiteN="${suiteName}" instance="instance5" testBaseURL="${test.baseURL}" sahiHost="${sahi.host}" sahiPort="${sahi.port}" />
-->
</parallel>
<!--sleep seconds="4"/-->
<!--antcall target="check-sahi-status"/-->
</sequential>
</parallel>
<sleep seconds="4"/>
<echo message="completed tests for chrome"/>
<sleep seconds="4"/>
<antcall target="stop-sahi"/>
</target>
sahiRunChromeTests is called, and I have attempted to run the 5 sets of tests in parallel using testrunner, and sahi directly.
Neither of these are producing the desired results. For testing puroses I have simplified each suite to run a simple test which involves logging into our web based application, and run against 2 out of the 5 configured instances.
I will frequently see one suite of tests running, and the other only giving me a message indicating that Chrome is dead.
On other occassions I will both instances load their respective logon pages, 1 will log in successfully, the second will fail to enter any data into the logon screen.
Any assistance in this matter is greatly appreciated.