Skip to content
Get Free Trial

Run Tests via Ant

Run Sahi Pro tests and suites with Apache Ant, on one machine or across several, with the Ant XML exported from the Run Configuration.

The Test Scenario Editor writes the Ant XML for you. Select the suite and click Run to open the Run Configuration, then:

  1. Choose Run in parallel.

  2. Click Export Run Config and choose Ant Target.

    The Run Configuration for book_store_regression.dd.csv with Run in parallel chosen and the Export Run Config menu open, Ant Target highlighted, above Gradle Task (Groovy) and Gradle Task (Kotlin)
  3. The Ant Target window shows the Ant XML. To add a target that runs the failed tests again, tick Add Retry Target. Click Copy to Clipboard.

    The Ant Target window with the generated Ant XML, the Add Retry Target checkbox, and the Help docs and Copy to Clipboard buttons

Paste the XML into an empty file and save it as an XML file, such as demo.xml, in your <SAHI_INSTALLATION_FOLDER>. You can now run the default ANT target in the xml file as

Terminal window
ant -f demo.xml

NOTE: The main target is the default target, so you do not need to specify the target when running the xml.

The above UI would generate an ANT xml that looks like the following.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/**
* Copyright Tyto Software Pvt. Ltd.
*/
-->
<project name="demo" default="runtestsie">
<taskdef name="sahi" classname="net.sf.sahi.ant.RunSahiTask" classpath="lib/ant-sahi.jar"/>
<target name="set_timestamp">
<tstamp>
<format property="ts" pattern="yyyy_MM_dd__HH_mm_ss" locale="en, IN"/>
</tstamp>
</target>
<target name="set_properties_ie" depends="set_timestamp">
<property name="scriptDir" value="D:/dev/SahiPro/userdata/scripts/"/>
<property name="scriptName" value="sahitests/ddcsv/test.dd.csv"/>
<property name="browser" value="ie"/>
<property name="startWith" value="BROWSER"/>
<property name="sendemail" value="true"/>
<property name="emailtrigger" value="success,failure"/>
<property name="emailproperties" value="D:\dev\SahiPro\userdata\config\email.properties"/>
<property name="sendemailForSubSuite" value="false"/>
<property name="sendemailperiodically" value="true"/>
<property name="sendemailperiodicallytime" value="30"/>
<property name="emailPasswordHidden" value="true"/>
<property name="baseURL" value="https://sahitest.com/demo/training/"/>
<property name="host" value="localhost"/>
<property name="port" value="9999"/>
<property name="singlesession" value="false"/>
<property name="threads" value="5"/>
<property name="abortedRetryCount" value="0"/>
<property name="failureRetryCount" value="0"/>
<property name="isAvoidSkipping" value="false"/>
<property name="isAutohealEnabled" value="false"/>
<property name="suiteTimeOut" value="0.0"/>
<property name="showPeriodicSummary" value="true"/>
<property name="failedSuiteName" value="test_failed_${browser}.dd.csv"/>
<property name="failedSuite" value="sahitests/ddcsv/${failedSuiteName}"/>
<property name="jsCodeCoverage" value="false"/>
</target>
<target name="runtestsie" depends="set_properties_ie">
<sahi suite="${scriptName}"
browsertype="${browser}"
startWith="${startWith}"
sendemail="${sendemail}"
emailtrigger="${emailtrigger}"
emailproperties="${emailproperties}"
sendEmailForSubSuite="${sendemailForSubSuite}"
sendEmailPeriodically="${sendemailperiodically}"
sendEmailPeriodicallyTime="${sendemailperiodicallytime}"
emailPasswordHidden="${emailPasswordHidden}"
baseurl="${baseURL}"
sahihost="${host}"
sahiport="${port}"
scriptsPathMaster="${scriptDir}"
failureproperty="sahi.failed.${browser}"
failedSuiteName="${failedSuiteName}"
haltonfailure="false"
singlesession="${singlesession}"
showPeriodicSummary="${showPeriodicSummary}"
threads="${threads}"
abortedRetryCount="${abortedRetryCount}"
failureRetryCount="${failureRetryCount}"
isAvoidSkipping="${isAvoidSkipping}"
isAutohealEnabled="${isAutohealEnabled}"
suiteTimeOut="${suiteTimeOut}"
jsCodeCoverage="${jsCodeCoverage}"
tags="(user||admin)&&medium"
userDefinedId="IETestRun1">
<!-- Custom fields - add, edit or remove as required -->
<customfield key="user" value="test"/>
<customfield key="mask_password" value="secret"/>
<!-- Offline reports -->
<report type="xml"/>
<report type="html" logdir="D:\temp\html"/>
</sahi>
<antcall target="failsahiie"/>
</target>
<target name="failsahiie" depends="set_properties_ie" if="sahi.failed.${browser}">
<fail message="Sahi tests failed on browser ${browser}!"/>
</target>
</project>

Let us look at the important attributes used in the ANT xml target (specified in bold above).

Attributes and their description

Attribute Description
scriptDir Specifies the path to the scripts folder. Can be the absolute path or a path relative to the userdata folder
scriptName Relative path to the script/suite/data driven suite. It is relative to scriptDir.
browser The browser on which the suite file plays back
baseurl Specifies URL which is the starting URL for all the scripts in the suite
host Hostname of the server where Sahi is running (Can be IP as well)
port Port on which Sahi is running
threads Number of simultaneous browser instances on which sahi tests will be run.
singlesession Since this is a parallel run, it will be “false”. If “true”, runs all scripts in a single browser without closing it between scripts.
showPeriodicSummary Takes “true” or “false”. If “true”, a periodic summary of script status is logged in the Ant Console.
isAutohealEnabled Takes “true” or “false”. If “true”, allows scripts to pick element using Sahi auto intelligence when element provided in script is not found. Refer Autoheal section for more details.
sendemail Takes “true” or “false”. If “true”, Sahi sends an email summarizing the test run.
emailtrigger Takes “success” or “failure” or “success,failure”. Triggers email in case of SUCCESS, FAILURE and both cases respectively.
emailproperties Path to the properties file that contains details about the mail viz. information about the sender, receiver, host, port, subject, content etc. Path can be the absolute path or relative to where this ant target is run from.
sendemailperiodically Takes “true” or “false”. If “true”, Sahi will send emails periodically till the suite run is complete.
sendemailperiodicallytime Specifies the interval in minutes at which periodic emails are to be sent.
failedSuiteName Name of the failed suite. It is of the form <suitename>_failed_<browser>.suite.
failedsuite Relative path to the failed suite. It is relative to scriptDir.
tags Tags should be specified only for dd.csv and .csv suites. Tags are specified so that it is easy to choose which scripts/testcases to run. eg. in the target above, all the scripts which have ‘medium’ tag and ‘admin’ or ‘user’ (or both) tag will be run.
userdefinedid The unique id that the user can pass to differentiate a suite from others. This is an optional attribute.
customfield Custom fields can be passed to the scripts using the customfield attribute. More than one custom field can be passed, by specifying additional customfield entries. Replace the custom field keys and values as appropriate. This is an optional attribute.
report Sahi can set offline logs to be generated in xml, html, junit, tm6 and excel types. The default type is html. Add separate entries for each report type as required. This is an optional attribute.

Command to execute the above ANT target

Terminal window
ant -f demo.xml

Distributed suite runs work through ANT targets as well.

These targets can be used from Jenkins to distribute the scripts of a suite on multiple machines.

The machine which distributes the scripts and manages the distributed run is referred to as the Master. All logs are visible from the Master. The other machines are called Slaves. Any machine in the distributed environment can serve as the Master. The machine which launches the distributed run is referred to as the Initiator.

In the Run Configuration:

  1. Choose Run distributed (multiple machines) and set the Distribution nodes. Leave Use Different Master off.

    Run Type in the Run Configuration with Run distributed (multiple machines) highlighted, and below it Distribution nodes localhost:9999, Use Different Master off, Sync Configurations off and Threads Per Node 5
  2. Click Export Run Config, choose Ant Target, and click Copy to Clipboard. Tick Add Retry Target first to add a target that runs the failed tests again.

Paste the XML into an empty file and save it as an XML file, such as demo.xml, in your <SAHI_INSTALLATION_FOLDER>. You can now run the default ANT target in the xml file as

Terminal window
ant -f demo.xml

NOTE: The main target is the default target, so you do not need to specify the target when running the xml.

The above UI would generate an ANT xml that looks like the following.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/**
* Copyright Tyto Software Pvt. Ltd.
*/
-->
<project name="demo" default="drunie">
<taskdef name="sahid" classname="in.co.sahi.ant.DAntRunner" classpath="lib/ant-sahi.jar"/>
<target name="set_timestamp">
<tstamp>
<format property="ts" pattern="yyyy_MM_dd_HH_mm_ss" locale="en, IN"/>
</tstamp>
</target>
<target name="set_properties_common" depends="set_timestamp">
<property name="scriptDir" value="D:/dev/SahiPro/userdata/scripts/"/>
<property name="host" value="localhost"/>
<property name="port" value="9999"/>
</target>
<target name="set_properties_ie" depends="set_properties_common">
<property name="scriptName" value="sahitests/ddcsv/test.dd.csv"/>
<property name="browser" value="ie"/>
<property name="startWith" value="BROWSER"/>
<property name="sendemail" value="true"/>
<property name="emailtrigger" value="success,failure"/>
<property name="emailproperties" value="D:\dev\SahiPro\userdata\config\email.properties"/>
<property name="sendemailForSubSuite" value="false"/>
<property name="sendemailperiodically" value="true"/>
<property name="sendemailperiodicallytime" value="30"/>
<property name="emailPasswordHidden" value="true"/>
<property name="baseURL" value="https://sahitest.com/demo/training/"/>
<property name="failedSuiteName" value="test_failed_${browser}.dd.csv"/>
<property name="failedSuite" value="sahitests/ddcsv/${failedSuiteName}"/>
<property name="showPeriodicSummary" value="true"/>
<property name="threads" value="5"/>
<property name="abortedRetryCount" value="0"/>
<property name="failureRetryCount" value="0"/>
<property name="isAvoidSkipping" value="false"/>
<property name="isSyncConfig" value="false"/>
<property name="isAutohealEnabled" value="false"/>
<property name="jsCodeCoverage" value="false"/>
<property name="suiteTimeOut" value="0.0"/>
</target>
<target name="drunie" depends="set_properties_ie, set_timestamp">
<sahid suite="${scriptName}"
sendEmail="${sendemail}"
emailtrigger="${emailtrigger}"
emailProperties="${emailproperties}"
sendEmailForSubSuite="${sendemailForSubSuite}"
sendEmailPeriodically="${sendemailperiodically}"
sendEmailPeriodicallyTime="${sendemailperiodicallytime}"
emailPasswordHidden="${emailPasswordHidden}"
baseurl="${baseURL}"
sahihost="${host}"
sahiport="${port}"
failureproperty="sahi.failed.${browser}"
failedSuiteName="${failedSuiteName}"
haltonfailure="false"
browsertype="${browser}"
startWith="${startWith}"
scriptsPathMaster="${scriptDir}"
threads="${threads}"
abortedRetryCount="${abortedRetryCount}"
failureRetryCount="${failureRetryCount}"
isAvoidSkipping="${isAvoidSkipping}"
isSyncConfig="${isSyncConfig}"
isAutohealEnabled="${isAutohealEnabled}"
jsCodeCoverage="${jsCodeCoverage}"
suiteTimeOut="${suiteTimeOut}"
showPeriodicSummary="${showPeriodicSummary}"
ignorePattern=".*(svn|copied).*"
tags="(user||admin)&&medium"
userDefinedId="IETestRun1">
<!-- Custom fields - add, edit or remove as required -->
<customfield key="user" value="test"/>
<customfield key="mask_password" value="secret"/>
<!-- Scripts will be distributed across all the nodes. The nodes may or may not include the Master machine -->
<node host="localhost" port="9999"/>
<node host="192.168.1.29" port="9999"/>
<!-- Offline reports -->
<report type="xml"/>
<report type="html" logdir="D:\temp\html"/>
</sahid>
<antcall target="failsahiie"/>
</target>
<target name="failsahiie" depends="set_properties_ie" if="sahi.failed.${browser}">
<fail message="Sahi tests failed on browser ${browser}!"/>
</target>
</project>

Let us look at the important attributes used in the ANT xml target (specified in bold above).

Attributes and their description

Attribute Description
scriptDir Specifies the path to the scripts folder. Can be the absolute path or a path relative to the userdata folder
host Hostname of the server where Sahi is running (Can be IP as well). Leave this as localhost
port Port on which Sahi is running
scriptName Relative path to the script/suite/data driven suite. It is relative to scriptDir.
browser The browser on which the suite file plays back
threads Number of simultaneous browser instances on which sahi tests will be run.
showPeriodicSummary Takes “true” or “false”. If “true”, a periodic summary of script status is logged in the Ant Console.
isAutohealEnabled Takes “true” or “false”. If “true”, allows scripts to pick element using Sahi auto intelligence when element provided in script is not found. Refer Autoheal section for more details.
baseurl Specifies URL which is the starting URL for all the scripts in the suite
sendemail Takes “true” or “false”. If “true”, Sahi sends an email summarizing the test run.
emailtrigger Takes “success” or “failure” or “success,failure”. Triggers email in case of SUCCESS, FAILURE and both cases respectively.
emailproperties Path to the properties file that contains details about the mail viz. information about the sender, receiver, host, port, subject, content etc. Path can be the absolute path or relative to where this ant target is run from.
sendemailperiodically Takes “true” or “false”. If “true”, Sahi will send emails periodically till the suite run is complete.
sendemailperiodicallytime Specifies the interval in minutes at which periodic emails are to be sent.
failedSuiteName Name of the failed suite. It is of the form <suitename>_failed_<browser>.suite.
failedsuite Relative path to the failed suite. It is relative to scriptDir.
tags Tags should be specified only for dd.csv and .csv suites. Tags are specified so that it is easy to choose which scripts/testcases to run. eg. in the target above, all the scripts which have ‘medium’ tag and ‘admin’ or ‘user’ (or both) tag will be run.
userdefinedid The unique id that the user can pass to differentiate a suite from others. This is an optional attribute.
node Each node attribute specifies a machine on which the tests should run. Add as many node entries as there are machines to run. The nodes may or may not include the Master machine (localhost). If the Master machine is not included, scripts will not be run on the Master. There can be 1 or more nodes.
customfield Custom fields can be passed to the scripts using the customfield attribute. More than one custom field can be passed, by specifying additional customfield entries. Replace the custom field keys and values as appropriate. This is an optional attribute.
report Sahi can set offline logs to be generated in xml, html, junit, tm6 and excel types. The default type is html. Add separate entries for each report type as required. This is an optional attribute.

Command to execute the above ANT target

Terminal window
ant -f demo.xml

In the Run Configuration:

  1. Choose Run distributed (multiple machines), turn on Use Different Master, and enter the master’s host and port.

    Run distributed (multiple machines) chosen in the Run Configuration, with Use Different Master turned on and highlighted, the master host 192.168.1.20 and port 9999
  2. Click Export Run Config, choose Ant Target, and click Copy to Clipboard. Tick Add Retry Target first to add a target that runs the failed tests again.

Paste the XML into an empty file and save it as an XML file, such as demo.xml, in your <SAHI_INSTALLATION_FOLDER>. You can now run the default ANT target in the xml file as

Terminal window
ant -f demo.xml

NOTE: The main target is the default target, so you do not need to specify the target when running the xml.

The above UI would generate an ANT xml that looks like the following.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/**
* Copyright Tyto Software Pvt. Ltd.
*/
-->
<project name="demo" default="drundiffmasterie">
<taskdef name="sahid" classname="in.co.sahi.ant.DAntRunner" classpath="lib/ant-sahi.jar"/>
<taskdef name="sahisync" classname="in.co.sahi.ant.DAntSync" classpath="lib/ant-sahi.jar"/>
<taskdef name="sahipull" classname="in.co.sahi.ant.DAntPull" classpath="lib/ant-sahi.jar"/>
<taskdef name="sahidelete" classname="in.co.sahi.ant.DAntDelete" classpath="lib/ant-sahi.jar"/>
<target name="set_timestamp">
<tstamp>
<format property="ts" pattern="yyyy_MM_dd__HH_mm_ss" locale="en, IN"/>
</tstamp>
</target>
<target name="set_properties_common" depends="set_timestamp">
<property name="scriptDir" value="D:/dev/SahiPro/userdata/scripts/"/>
<property name="masterhost" value="192.168.1.30"/>
<property name="masterport" value="9999"/>
</target>
<target name="set_properties_ie" depends="set_properties_common">
<property name="scriptName" value="sahitests/ddcsv/test.dd.csv"/>
<property name="browser" value="ie"/>
<property name="startWith" value="BROWSER"/>
<property name="sendemail" value="true"/>
<property name="emailtrigger" value="success,failure"/>
<property name="emailproperties" value="D:\dev\SahiPro\userdata\config\email.properties"/>
<property name="sendemailForSubSuite" value="false"/>
<property name="sendemailperiodically" value="true"/>
<property name="sendemailperiodicallytime" value="30"/>
<property name="emailPasswordHidden" value="true"/>
<property name="baseURL" value="https://sahitest.com/demo/training/"/>
<property name="failedSuiteName" value="test_failed_${browser}.dd.csv"/>
<property name="failedSuite" value="sahitests/ddcsv/${failedSuiteName}"/>
<property name="threads" value="5"/>
<property name="abortedRetryCount" value="0"/>
<property name="failureRetryCount" value="0"/>
<property name="isAvoidSkipping" value="false"/>
<property name="isSyncConfig" value="false"/>
<property name="isAutohealEnabled" value="false"/>
<property name="showPeriodicSummary" value="true"/>
<property name="jsCodeCoverage" value="false"/>
<property name="configPath" value=""/>
<property name="suiteTimeOut" value="0.0"/>
</target>
<target name="drundiffmasterie" depends="set_properties_ie, set_timestamp">
<!-- Sync suite to Master staging folder -->
<sahisync originFolder="${scriptDir}" destFolder="temp/scripts/staging/${ts}_${browser}" ignorePattern=".*(svn|copied).*" suitePath="${scriptDir}${scriptName}" csvSeparator="," scriptExtensions="sah;sahi;js;ar.csv" scenarioExtensions=".s.csv;xls;xlsx" javaDir="java" exposedJavaClasses="exposed_classes.txt"
isSyncConfig="${isSyncConfig}" isAutohealEnabled="${isAutohealEnabled}" configPath="${configPath}">
<node host="${masterhost}" port="${masterport}"/>
</sahisync>
<sahid suite="${scriptName}"
sendEmail="${sendemail}"
emailtrigger="${emailtrigger}"
emailProperties="${emailproperties}"
sendEmailForSubSuite="${sendemailForSubSuite}"
sendEmailPeriodically="${sendemailperiodically}"
sendEmailPeriodicallyTime="${sendemailperiodicallytime}"
emailPasswordHidden="${emailPasswordHidden}"
baseurl="${baseURL}"
sahihost="${masterhost}"
sahiport="${masterport}"
failureproperty="sahi.failed.${browser}"
failedSuiteName="${failedSuiteName}"
haltonfailure="false"
browsertype="${browser}"
startWith="${startWith}"
scriptsPathMaster="temp/scripts/staging/${ts}_${browser}/"
scriptsPathInitiator="${scriptDir}"
threads="${threads}"
abortedRetryCount="${abortedRetryCount}"
failureRetryCount="${failureRetryCount}"
isAvoidSkipping="${isAvoidSkipping}"
isAutohealEnabled="${isAutohealEnabled}"
isSyncConfig="${isSyncConfig}"
jsCodeCoverage="${jsCodeCoverage}"
showPeriodicSummary="${showPeriodicSummary}"
suiteTimeOut="${suiteTimeOut}"
isDifferentMaster="true"
ignorePattern=".*(svn|copied).*"
tags="(user||admin)&&medium"
userDefinedId="IETestRun1">
<!-- Custom fields - add, edit or remove as required -->
<customfield key="user" value="test"/>
<customfield key="mask_password" value="secret"/>
<!-- Scripts will be distributed across all the nodes. The nodes may or may not include the Master machine -->
<node host="localhost" port="9999"/>
<node host="192.168.1.29" port="9999"/>
<!-- Offline reports -->
<report type="xml" logdir="logs/temp/xml/${ts}"/>
<report type="html" logdir="logs/temp/html/${ts}"/>
</sahid>
<!-- Delete suite from Master staging folder -->
<sahidelete host="${masterhost}"
port="${masterport}"
filePath="temp/scripts/staging/${ts}_${browser}" isSyncConfig="${isSyncConfig}" isAutohealEnabled="${isAutohealEnabled}" scriptDir="${scriptDir}">
</sahidelete>
<!-- Pull the logs from the Master onto the Initiator machine -->
<sahipull sourceHost="192.168.1.30" sourcePort="9999" originFolder="logs/temp/xml/${ts}" destFolder="logs/xml" ignorePattern=".*(svn|copied).*"/>
<sahipull sourceHost="192.168.1.30" sourcePort="9999" originFolder="logs/temp/html/${ts}" destFolder="D:\temp\html" ignorePattern=".*(svn|copied).*"/>
<antcall target="failsahiie"/>
</target>
<target name="failsahiie" depends="set_properties_ie" if="sahi.failed.${browser}">
<fail message="Sahi tests failed on browser ${browser}!"/>
</target>
</project>

Let us look at the important attributes used in the ANT xml target (specified in bold above).

Attributes and their description

Attribute Description
scriptDir Specifies the path to the scripts folder on the Initiator machine. This can be an absolute path or a path relative to where Ant is run from
masterhost Hostname of the different Master server where Sahi is running (Can be IP as well)
masterport Port on which Sahi is running
scriptName Relative path to the script/suite/data driven suite. It is relative to scriptDir.
browser The browser on which the suite file plays back
baseurl Specifies URL which is the starting URL for all the scripts in the suite
threads Number of simultaneous browser instances on which sahi tests will be run.
showPeriodicSummary Takes “true” or “false”. If “true”, a periodic summary of script status is logged in the Ant Console.
isAutohealEnabled Takes “true” or “false”. If “true”, allows scripts to pick element using Sahi auto intelligence when element provided in script is not found. Refer Autoheal section for more details.
sendemail Takes “true” or “false”. If “true”, Sahi sends an email summarizing the test run.
emailtrigger Takes “success” or “failure” or “success,failure”. Triggers email in case of SUCCESS, FAILURE and both cases respectively.
emailproperties Path to the properties file that contains details about the mail viz. information about the sender, receiver, host, port, subject, content etc. Path can be the absolute path or relative to where this ant target is run from.
sendemailperiodically Takes “true” or “false”. If “true”, Sahi will send emails periodically till the suite run is complete.
sendemailperiodicallytime Specifies the interval in minutes at which periodic emails are to be sent.
failedSuiteName Name of the failed suite. It is of the form <suitename>_failed_<browser>.suite.
failedsuite Relative path to the failed suite. It is relative to scriptDir.
tags Tags should be specified only for dd.csv and .csv suites. Tags are specified so that it is easy to choose which scripts/testcases to run. eg. in the target above, all the scripts which have ‘medium’ tag and ‘admin’ or ‘user’ (or both) tag will be run.
userdefinedid The unique id that the user can pass to differentiate a suite from others. This is an optional attribute.
node Each node attribute specifies a machine on which the tests should run. Add as many node entries as there are machines to run. The nodes may or may not include the Master machine. If the Master machine is not included, scripts will not be run on the Master. There can be 1 or more nodes.
customfield Custom fields can be passed to the scripts using the customfield attribute. More than one custom field can be passed, by specifying additional customfield entries. Replace the custom field keys and values as appropriate. This is an optional attribute.

Command to execute the above ANT target

Terminal window
ant -f demo.xml

Ability to register Nodes externally (from Sahi Pro V6.1.0)

Section titled “Ability to register Nodes externally (from Sahi Pro V6.1.0)”

It is now possible to register a new Node for a currently running distributed run.

Using registerNodes.bat/registerNodes.sh

  1. Open a command prompt and cd to sahi/userdata/bin (or click on the “Bin” link on the Sahi Dashboard)

  2. Run register_nodes.bat to see the syntax

    D:\sahi_pro\userdata\bin>register_nodes.bat
    --
    Usage: register_nodes.bat <extnodes> <userDefinedId> <suiteId>
    - extnodes is a comma separated string of host:port combos, example: "machine1:9999,machine2:9999".
    If multiple nodes are specified, enclose them in double quotes.
    - userDefinedId is the User defined Id specified while running the original suite
    - suiteId is the SuiteId of the running suite, and can be found from Suite Info section in the Suite Report log
    - NOTE: Only one of suiteId or userDefinedId is required. If both suiteId and userDefinedId are passed, suiteId will be used to identify the running suite.
    --
    Example:
    1. Registering one machine using userDefinedId (say abc1234).
    register_nodes.bat machine1:9999 abc1234
    2. Registering more than one machine using userDefinedId.
    register_nodes.bat "machine1:9999,machine2:9999" abc1234
    3. Registering one machine using suiteId (say sahi_a0ba301605a8f04cb10881e0ddcd96f9dfbd). NOTE: Some value HAS to be passed for the second parameter - userDefinedId. Pass "".
    register_nodes.bat machine1:9999 "" sahi_a0ba301605a8f04cb10881e0ddcd96f9dfbd
    4. Registering more than one machine using suiteId. NOTE: Some value HAS to be passed for the second parameter - userDefinedId. Pass "".
    register_nodes.bat "machine1:9999,machine2:9999" "" sahi_a0ba301605a8f04cb10881e0ddcd96f9dfbd
    --
    D:\sahi_pro\userdata\bin>
  3. Nodes can be registered for a currently running suite. The suite can be specified either using userDefinedId or suiteId. If both are specified, suiteId will be used. suiteId for the current run can be found from the Suite Info section of the Suite report logs.

    • To register using userDefinedId, use something like the following

      Terminal window
      register_nodes.bat "192.168.1.100:9999,192.168.1.101:9999" myUserDefinedId

      Note that these values are indicative. Please use your own values.

    • To register using suiteId, use something like the following

      Terminal window
      register_nodes.bat "192.168.1.100:9999,192.168.1.101:9999" "" sahi_a0ba301605a8f04cb10881e0ddcd96f9dfbd

      Note that these values are indicative. Please use your own values.

Using an ANT target Copy the following content to an empty file and save the file as an xml, say registernodes.xml in your <SAHI_INSTALLATION_FOLDER>. You can now run the default ANT target in the xml file as

Terminal window
ant -f registernodes.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/**
* Copyright Tyto Software Pvt. Ltd.
*/
-->
<project name="demo" default="register">
<taskdef name="sahinodeclient" classname="in.co.sahi.ant.DAntNodeClient" classpath="lib/ant-sahi.jar"/>
<!-- Use suiteId or userDefinedId. If both are specified, suiteId would be used. -->
<target name="register">
<sahinodeclient
sahihost="localhost"
sahiport="9999"
userDefinedId="myUserDefinedId">
<node host="192.168.1.100" port="9999"/>
<node host="192.168.1.101" port="9999"/>
</sahinodeclient>
</target>
</project>

Note that all these values are indicative.

Attributes and their description

Attribute Description
sahihost Hostname of the Master where Sahi is running (Can be IP as well).
sahiport Port on which Sahi is running
userDefinedId UserDefinedId specified while running the original suite
suiteId SuiteId of the running suite. Get this value from the Suite Info section of the Suite Report logs
node Specify one entry each for every node that you want to register.

Command to execute the above ANT target

Terminal window
ant -f registernodes.xml

Stop All from the Editor can be used to kill all running scripts/suites.

This is now possible through an ANT target as well.

The ANT target gives the ability to kill a specific running suite or kill all the running suites.

Copy the following content to an empty file and save the file as an xml, say killall.xml in your <SAHI_INSTALLATION_FOLDER>. You can now run the default ANT target in the xml file as

Terminal window
ant -f killall.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/**
* Copyright Tyto Software Pvt. Ltd.
*/
-->
<project name="demo" default="kill">
<taskdef name="sahikill" classname="in.co.sahi.ant.DKillTask" classpath="lib/ant-sahi.jar"/>
<!-- This target will kill the running suite(s) on sahihost. sahihost can be other than localhost as well. -->
<!-- If neither suiteId nor userDefinedId is specified, all running suites on this Master will be killed. -->
<!-- If you wish to kill a specific suite, use suiteId or userDefinedId. If both are specified, suiteId would be used. -->
<target name="kill">
<sahikill
sahihost="localhost"
sahiport="9999">
</sahikill>
</target>
</project>

Attributes and their description

Attribute Description
sahihost Hostname of the Master where Sahi is running (Can be IP as well).
sahiport Port on which Sahi is running
userDefinedId UserDefinedId specified while running the original suite
suiteId SuiteId of the running suite. Get this value from the Suite Info section of the Suite Report logs

Command to execute the above ANT target

Terminal window
ant -f killall.xml