UserDefinedId
It is possible for users to pass in a unique id of their own to differentiate a suite from another. This is referred to as UserDefinedId.
Passing UserDefinedId
You can pass/set the UserDefinedId in a variety of ways.
-
UserDefinedId can be passed from testrunner.bat as follows.
-
Edit testrunner.bat.
Change the following line
Terminal window java -cp %SAHI_HOME%\lib\ant-sahi.jar in.co.sahi.distributed.DSahiRunner %CUSTOM_FIELDS% -isNonDistributedRun true-scriptsPathMaster %SCRIPTS_PATH% -suite %1 -browserDeviceParams %3 -logsInfo "%LOGS_INFO%"-baseURL "%START_URL%" -host localhost -port 9999 -threads %THREADS% -abortedRetryCount %ABORTED_RETRY_COUNT%-failureRetryCount %FAILURE_RETRY_COUNT% -useSingleSession %SINGLE_SESSION% -sendEmail %SEND_EMAIL_REPORT%-emailTrigger "%EMAIL_TRIGGER%" -emailProperties "%EMAIL_PROPERTIES%"-sendemailForSubSuite "%SEND_EMAIL_AFTER_EACH_SUBSUITE%"-sendEmailPeriodically "%SEND_EMAIL_REPORT_PERIODICALLY%"-sendEmailPeriodicallyTime "%SEND_EMAIL_REPORT_PERIODICALLY_TIME%"-emailPasswordHidden "%EMAIL_PASSWORD_HIDDEN%"-showPeriodicSummary %SHOW_PERIODIC_SUMMARY% -tags %4to
Terminal window java -cp %SAHI_HOME%\lib\ant-sahi.jar in.co.sahi.distributed.DSahiRunner %CUSTOM_FIELDS%-userDefinedId "specify your UserDefinedId here" -isNonDistributedRun true-scriptsPathMaster %SCRIPTS_PATH% -suite %1 -browserDeviceParams %3 -logsInfo "%LOGS_INFO%"-baseURL "%START_URL%" -host localhost -port 9999 -threads %THREADS% -abortedRetryCount %ABORTED_RETRY_COUNT%-failureRetryCount %FAILURE_RETRY_COUNT% -useSingleSession %SINGLE_SESSION% -sendEmail %SEND_EMAIL_REPORT%-emailTrigger "%EMAIL_TRIGGER%" -emailProperties "%EMAIL_PROPERTIES%"-sendemailForSubSuite "%SEND_EMAIL_AFTER_EACH_SUBSUITE%"-sendEmailPeriodically "%SEND_EMAIL_REPORT_PERIODICALLY%"-sendEmailPeriodicallyTime "%SEND_EMAIL_REPORT_PERIODICALLY_TIME%"-emailPasswordHidden "%EMAIL_PASSWORD_HIDDEN%" -showPeriodicSummary %SHOW_PERIODIC_SUMMARY% -tags %4Replace “specify your UserDefinedId here” with your UserDefinedId.
-
-
If you are using ANT to run the script, you can specify the UserDefinedId in the
<sahi>target.Example:
<target name="runfftests"><sahi suite="../userdata/scripts/sahitests/demo.suite"browserType="firefox11"baseurl="http://${urlbase}/demo/"sahihost="localhost"sahiport="9999"failureproperty="sahi.failed"haltonfailure="false"userDefinedId="sahi.co.in_firefox_english"threads="6"><customfield key="language" value="english"/><customfield key="failedScriptsSuite" value="../userdata/scripts/failed_scripts.suite"/><report type="html"/></sahi><antcall target="retryfailed"/></target> -
There are instances when the UserDefinedId can be known only at runtime. In such cases, you can set it from inside the script as follows.
ScriptRunner.getSession().getSuiteInfo().setUserDefinedId("test");
UserDefinedId not visible in V5.x.y by default
Section titled “UserDefinedId not visible in V5.x.y by default”By default, UserDefinedId is not displayed in the list of Suite Reports.
To display it, do the following steps.
- Take a backup of
userdata\config\reports\html\suites_list.xsl. - Edit
userdata\config\reports\html\suites_list.xsl.-
Right at the start, you will see two XSL params
showUserDefinedIdandshowBaseUrl.<xsl:param name="showUserDefinedId" select="'false'" /><xsl:param name="showBaseUrl" select="'true'" /> -
Set showUserDefinedId to ‘true’. The line will look like:
<xsl:param name="showUserDefinedId" select="'true'" /> -
Set showBaseUrl as “‘true’” or “‘false’” based on whether you want to display the Base Url (Start Url) or not.
-
From then on, your reports will start displaying the User Defined Id.

