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.
How to create batch files to call multiple scripts
Hello Team,
I have multiple script files to perform each smoke test case in my project. Now, i need to combine them in one file or batch file. I have tried to use _include() method to call multiple files but that too is a sahi script file. I want to make a batch file in which i can put/call all these files and excute all my smoke test case in one go.
Please tell me how to do it.
I have multiple script files to perform each smoke test case in my project. Now, i need to combine them in one file or batch file. I have tried to use _include() method to call multiple files but that too is a sahi script file. I want to make a batch file in which i can put/call all these files and excute all my smoke test case in one go.
Please tell me how to do it.
Comments
I have tried creating suite for calling multiple scripts, configured firefox and made command line query to run the suite file in firefox which is like this:
java -cp ..\lib\ant-sahi.jar net.sf.sahi.test.TestRunner c:/sahi/scripts/Client_Matter_Party.suite "C:\Program Files\Mozilla Firefox\firefox.exe" http://machine-name/app-name default localhost 9999 3 firefox.exe
The exception which Im getting is like this:
java.lang.reflect.InvocationTargetException
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 net.sf.sahi.command.CommandExecuter.execute(CommandExecuter.java:52)
at net.sf.sahi.LocalRequestProcessor.getLocalResponse(LocalRequestProcessor.java:42)
at net.sf.sahi.ProxyProcessor.processLocally(ProxyProcessor.java:218)
at net.sf.sahi.ProxyProcessor.run(ProxyProcessor.java:77)
at java.lang.Thread.run(Unknown Source)
Caused by: net.sf.sahi.util.FileNotFoundRuntimeException: java.io.FileNotFoundEx
ception: c:\sahi\scripts\Client_Matter_Party.suite (The system cannot find the file specified)
at net.sf.sahi.util.Utils.readFile(Utils.java:113)
at net.sf.sahi.util.Utils.readFile(Utils.java:100)
at net.sf.sahi.test.SuiteLoader.processSuiteFile(SuiteLoader.java:55)
at net.sf.sahi.test.SuiteLoader.loadScripts(SuiteLoader.java:35)
at net.sf.sahi.test.SuiteLoader.<init>(SuiteLoader.java:27)
at net.sf.sahi.test.SahiTestSuite.loadScripts(SahiTestSuite.java:94)
at net.sf.sahi.test.SahiTestSuite.<init>(SahiTestSuite.java:89)
at net.sf.sahi.command.Suite.start(Suite.java:40)
... 9 more
Caused by: java.io.FileNotFoundException: c:\sahi\scripts\Client_Matter_Party.suite (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at net.sf.sahi.util.Utils.readFile(Utils.java:110)
... 16 more
java.lang.reflect.InvocationTargetException
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 net.sf.sahi.command.CommandExecuter.execute(CommandExecuter.java:52)
at net.sf.sahi.LocalRequestProcessor.getLocalResponse(LocalRequestProcessor.java:42)
at net.sf.sahi.ProxyProcessor.processLocally(ProxyProcessor.java:218)
at net.sf.sahi.ProxyProcessor.run(ProxyProcessor.java:77)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at net.sf.sahi.command.Suite.kill(Suite.java:84)
... 9 more
One of the line in above exception says that file specified is not found.However, i have place the file in the same folder as specified.
Please give your views on this....
Thank You.
Regards,
Ashvin.
Double recheck your file name and your file path. Copy paste that path in explorer and see if it helps you narrow down the error.
Thanks for the post.
It seems there was some problem in my code itself. Now things are working fine. But Im having one problem that the application which Im testing requires first time LDAP authentication. Now what happens here is that when i specify the URL, it doesnt asks for authentication rather page sends "Bad Request" message to me and firefox closes killing the file under process.
Please help me resolve this as i do not know how to bypass password authentication or apply it in my command line argument.
I had solved the problem. Now Im having a new problem. I have my test website running on my localhost only. Due to this i need to first open firefox and disable all proxies, start my website with LDAP authentication, again enable my proxy and refresh the page. Only then can i use SAHI controller on firefox. Now, whats happening here is that i need to set SAHI proxy before start using the suite file which, while actual run, coincides with actual website and does not respoonds.
What should be the probable solution to this problem.