18 January 2026:


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.

How to run multiple scripts using cmd command

edited November -1 in Sahi - Open Source
Hi,

I'm using SAHI OS for my current project.

OS=Windows
Browser =IE6
SAHI
Version : V3.5
Build : 2011-07-19


I have few scripts which are kept in "sahi\userdata\scripts" path. As per the information available on page sahi.co.in/w/Running+multiple+tests+in+batch+mode i'm trying to use CMD command to run them.

I have created one "myfirst.suite" file in scripts folder with the below content

Abuse_TC1.sah ://superclientstg2.sl.ca/consumerDSLWGP_Simulator/wg3.html
Abuse_TC2.sah //superclientstg2.sl.ca/consumerDSLWGP_Simulator/wg3.html

and then using the below command for execution

\sahi\userdata\bin>testrunner.bat myfirst.suite https:superclientstg2.sl.ca/consumerDSLWGP_simulator/wg3.html ie

But after executing this line nothing happend and i got some information on cmd with below like
usesinglesession =FALSE

Please help me how to run my scripts on batch.

NOTE: Not able to post correct URL's not allowed for new member

Comments

  • Hi

    usesinglesession =FALSE is totally right. Please post the whole output. If you run this command, does a browser open. Please post the whole command.

    Regards
    Wormi
  • hi.

    cmd :
    sahi\userdata\bin>testrunner.bat myfirst.suite htps:superclientstg2.slonsumerDSLWGP_Simulator/wg3 ie

    Response:

    test=scripts/myfirst.suite
    browserType=ie
    baseURL=https:superclientstg2.sl.ca/consumerDSLWGP_Simulatohtml
    host=localhost
    port=9999
    threads=5
    useSingleSession=false

    suiteName = scripts/myfirst.suite
    base = https:superclientstg2.sl.caconsumerDSLWGP_Simulatorwg3.html
    sahiHost = localhost
    port = 9999
    threads = 5
    browserType = ie
    this.isSingleSession == false
    Added shutdown hook.
    http:/localhost:9999/_s_/dyn/Suite_start?suite=scripts%2Fmyfirst.suite&base=htt
    ps%3A%2F%2Fsuperclientstg2.sl.ca%2FconsumerDSLWGP_Simulator%2Fwg3.html&threads=5
    &sahisid=sahi_7a6569080946b04a3608391051bb9737ac7a&browserType=ie&html=


    Nothing happend after this, no browser opened.

    Also let me know do i need to open sahi Dashboard before running the above command.
    also not that i'm using https site for web testing.

    Thanks in advance!!
  • Yes, you have to have a sahi proxy running, either the dashbord.bat or the sahi.bat. But if there is no proxy running, you should get an error message. If you are testing https sites, check if all certificates are accepted with the Sahi SSLManager.

    If the browser won't open, check the browser.xml if the settings are right ( e.g. path, options etc)
  • Hey thanks,

    Problem what i was facing with IE is that on SAHI dashboard it is IE8 and version of IE i'm having is IE6.

    so i tried to run it from firefox and it worked fine!!

    I'm thinking to Re-install IE , may be then it will work good .
  • hi,

    I tried to run it using IE with reinstalling, this time i got IE page opened but nothing is happned after that..script is not running after 150 sec.

    Any idea what mistake i'm making?
  • Hi globalworming,

    Is it possible to run a script multiple times?

    I have this .bat file that i will run in the command line:
    cd sahi/userdata/bin
    testrunner.bat demo/demo.suite http://sahi.co.in/demo/ firefox 
    testrunner.bat demo/demo.suite http://sahi.co.in/demo/ firefox
    testrunner.bat demo/demo.suite http://sahi.co.in/demo/ firefox
    


    Thanks and regards.
  • globalwormingglobalworming Moderators
    Well.. why don't you just add more scripts to your demo.suite?
    Or just write a loop in some kind of executeSuite.bat?
    Maybe you could tell me what benefit you expect from running scripts multiple times?
  • Hi globalworming,

    Thanks for the reply.
    For now, i still don't have an answer for the benefit.

    For the demo.suite, is it possible to include scripts in different folders?
    I would want to create a folder where all *.suite scripts resides.
    These *.suite contains *.sah scripts which are residing in other folders as well.

    scripts/suite/demo.suite
    scripts/folder1/sub_folder1/script1.sah
    scripts/folder2/script2.sah
    scripts/script3.sah
    


    Thanks and regards.
  • globalwormingglobalworming Moderators
    Totally legit, put your suitefiles whereever you wan't and fill them with relativ (absolute may work too) paths to scripts. They dont have to be subfolders, you could write "../../scripts/script.sah" too.
  • Okay.

    So, i just rename my demo.suite to demo.sah and initialize demo.sah to be run in console.
    I still can't get it to work.

    SAHI CONSOLE
    logsInfo=true
    logType=true logDir=C:\Program Files\SahiPro v4.2\userdata\logs\playback\single_order_suite_firefox__23May2012__18_23_49_089
    May 23, 2012 6:23:49 PM net.sf.sahi.test.ProcessHelper execute
    INFO: "C:\Program Files\Mozilla Firefox\firefox.exe" -profile "C:/Program Files/SahiPro v4.2/userdata/browser/ff/profiles/sahi0" -no-remote "http://sahi.example
    .com/_s_/dyn/Player_auto?startUrl=http%3A%2F%2Fuprinting.com%2F__SahiAmpersandSahi__sahisid=sahi_1657e40b06aeb04b4809a6505f58f5a56121sahixaeca6c060966f04a620aeb20867e37d2ca0bx__SahiAmpersandSahi__isSingleSession=true"
    
    #### Running Script: C:\Program Files\SahiPro v4.2\userdata\scripts\batch_suites\single_order_suite.sah
    Killing C:\Program Files\SahiPro v4.2\userdata\scripts\batch_suites\single_order_suite.sah
    May 23, 2012 6:23:50 PM net.sf.sahi.test.ProcessHelper kill
    INFO: Kill: null
    java.lang.NullPointerException
            at net.sf.sahi.test.ProcessHelper.killPIDs(ProcessHelper.java:171)
            at net.sf.sahi.test.ProcessHelper.kill(ProcessHelper.java:164)
            at net.sf.sahi.test.BrowserLauncher.kill(BrowserLauncher.java:98)
            at net.sf.sahi.test.SahiTestSuite.killBrowserForSingleSession(SahiTestSuite.java:299)
            at net.sf.sahi.test.SahiTestSuite.executeSuite(SahiTestSuite.java:269)
            at net.sf.sahi.test.SahiTestSuite.run(SahiTestSuite.java:187)
            at net.sf.sahi.command.Suite$1.run(Suite.java:157)
    ERROR:  'C:\Program Files\SahiPro v4.2\userdata\config\reports\true\script_report.xsl (The system cannot find the path specified)'
    FATAL ERROR:  'Could not compile stylesheet'
    javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
            at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source)
            at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(Unknown Source)
            at in.co.sahi.util.XSLTransformer.<init>(XSLTransformer.java:24)
            at in.co.sahi.report.ReportType.transform(ReportHelper.java:341)
            at in.co.sahi.report.ReportHelper.writeTestResultsToFS(ReportHelper.java:214)
            at in.co.sahi.report.ReportHelper.createReports(ReportHelper.java:106)
            at net.sf.sahi.test.SahiTestSuite.generateSuiteReport(SahiTestSuite.java:343)
            at net.sf.sahi.test.SahiTestSuite.notifyComplete(SahiTestSuite.java:144)
            at net.sf.sahi.rhino.RhinoScriptRunner.stop(RhinoScriptRunner.java:306)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
            at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:247)
            at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:119)
            at org.mozilla.javascript.gen.c11._c67(RhinoScriptRunner.run:589)
            at org.mozilla.javascript.gen.c11.call(RhinoScriptRunner.run)
            at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:119)
    May 23, 2012 6:23:50 PM net.sf.sahi.test.ProcessHelper$PIDGatherer 
    run
    INFO: PIDs: [5708]; 1572 ms
            at org.mozilla.javascript.gen.c11._c113(RhinoScriptRunner.run:986)
            at org.mozilla.javascript.gen.c11.call(RhinoScriptRunner.run)
            at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:119)
            at org.mozilla.javascript.gen.c12._c0(RhinoScriptRunner.run:1)
            at org.mozilla.javascript.gen.c12.call(RhinoScriptRunner.run)
            at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
            at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
            at org.mozilla.javascript.gen.c12.call(RhinoScriptRunner.run)
            at org.mozilla.javascript.gen.c12.exec(RhinoScriptRunner.run)
            at org.mozilla.javascript.Context.evaluateString(Context.java:1104)
    Shutting down ...       at net.sf.sahi.rhino.RhinoScriptRunner.run(RhinoScriptRunner.java:186)
            at java.lang.Thread.run(Unknown Source)java.lang.NullPointerException
            at in.co.sahi.util.XSLTransformer.transform(XSLTransformer.java:34)
            at in.co.sahi.report.ReportType.transform(ReportHelper.java:342)
            at in.co.sahi.report.ReportHelper.writeTestResultsToFS(ReportHelper.java:214)
            at in.co.sahi.report.ReportHelper.createReports(ReportHelper.java:106)
            at net.sf.sahi.test.SahiTestSuite.generateSuiteReport(SahiTestSuite.java:343)
            at net.sf.sahi.test.SahiTestSuite.notifyComplete(SahiTestSuite.java:144)
            at net.sf.sahi.rhino.RhinoScriptRunner.stop(RhinoScriptRunner.java:306)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
            at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:247)
            at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:119)
            at org.mozilla.javascript.gen.c11._c67(RhinoScriptRunner.run:589)
            at org.mozilla.javascript.gen.c11.call(RhinoScriptRunner.run)
            at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:119)
            at org.mozilla.javascript.gen.c11._c113(RhinoScriptRunner.run:986)
            at org.mozilla.javascript.gen.c11.call(RhinoScriptRunner.run)
            at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:119)
            at org.mozilla.javascript.gen.c12._c0(RhinoScriptRunner.run:1)
            at org.mozilla.javascript.gen.c12.call(RhinoScriptRunner.run)
            at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
            at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
            at org.mozilla.javascript.gen.c12.call(RhinoScriptRunner.run)
            at org.mozilla.javascript.gen.c12.exec(RhinoScriptRunner.run)
            at org.mozilla.javascript.Context.evaluateString(Context.java:1104)
            at net.sf.sahi.rhino.RhinoScriptRunner.run(RhinoScriptRunner.java:186)
            at java.lang.Thread.run(Unknown Source)
    
    CMD CONSOLE
    C:\Users\crabaino.WEBPRODEV>sahi_batch.bat
    C:\Users\crabaino.WEBPRODEV>cd c:\Program Files\SahiPro v4.2\userdata\bin
    c:\Program Files\SahiPro v4.2\userdata\bin>testrunner.bat batch_suites/single_order_suite.sah http://uprinting.com/ firefox
    
    test=scripts/batch_suites/single_order_suite.sah
    browserType=firefox
    logsInfo=true
    baseURL=http://uprinting.com/
    host=localhost
    port=9999
    threads=1
    useSingleSession=true
    
    port=9999
    useSingleSession=true
    browserPath=null
    host=localhost
    test=scripts%2Fbatch_suites%2Fsingle_order_suite.sah
    threads=1
    logsInfo=true
    suitePath=scripts%2Fbatch_suites%2Fsingle_order_suite.sah
    isSingleSessionS=true
    baseURL=http%3A%2F%2Fuprinting.com%2F
    browserType=firefox
    suiteId=sahi_1657e40b06aeb04b4809a6505f58f5a56121
    &port=9999&useSingleSession=true&browserPath=null&host=localhost&test=scripts%2Fbatch_suites%2Fsingle_order_suite.sah&threads=1&logsInfo=true&suitePath=scripts%2Fbatch_suites%2Fsingle_order_suite.sah&isSingleSessionS=true&baseURL=http%3A%2F%2Fuprinting.com%2F&browserType=firefox&suiteId=sahi_1657e40b06aeb04b4809a6505f58f5a56121
    Added shutdown hook.
    http://localhost:9999/_s_/dyn/Suite_start?a=a&port=9999&useSingleSession=true&browserPath=null&host=localhost&test=scripts%2Fbatch_suites%2Fsingle_order_suite.sah&threads=1&logsInfo=true&suitePath=scripts%2Fbatch_suites%2Fsingle_order_suite
    .sah&isSingleSessionS=true&baseURL=http%3A%2F%2Fuprinting.com%2F&browserType=fir
    efox&suiteId=sahi_1657e40b06aeb04b4809a6505f58f5a56121&sahisid=sahi_1657e40b06aeb04b4809a6505f58f5a56121
    firefox: FAILURE
    Shutting down ...
    
  • globalwormingglobalworming Moderators
    edited May 2012
    Hi

    you can't name a .suite .sah.. Sahi will think it is a single script to execute..
    use demo.suite and fill it with paths to scripts

    Also:

    browserPath=null? firefox: FAILURE?
    there may be a problem with you browser.xml?
    And why is there an report.xml error? I don't see no option like "-xmlLog true" is this normal? May be due to Sahi Pro but I am not sure.
Sign In or Register to comment.