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.
_execute with batch files
I am using a batch file to reset my test data back to its initial state.
If I then run the sahi script from the same location as the batch file, nothing happens.
Any suggsestions?
Thank you
Donna
This is file resetDataThinning.bat:
C:\\Progra~1\\Java\\jdk1.6.0_04\\bin\\javac ClearDatabase.java
C:\\Progra~1\\Java\\jdk1.6.0_04\\bin\\java -cp .;C:\\Progra~1\\sahi\\lib\\jtds\\jtds-1.2.2.jar ClearDatabase 5
I then have a script set up with the following
_execute("resetDataThinning.bat");
If I run the batch file as a standalone batch file the values are reset successfully.If I then run the sahi script from the same location as the batch file, nothing happens.
Any suggsestions?
Thank you
Donna
Comments
Here's the _excute() code:
Sahi.prototype._execute = function (command, sync) {
var is_sync = sync ? "true" : "false";
var status = this._callServer("CommandInvoker_execute", "command=" + encodeURIComponent(command) + "&sync=" + is_sync);
if ("success" != status) {
throw new Error("Execute Command Failed!");
}
}
here is the example from list of sahi API:
Syntax:
_execute(command, isSynchronous)
The parameters are:
command: command to be executed
isSynchronous: true or false.
Set this to true if you want the script to wait till the process returns. Setting this to false will execute the command in a thread and continue.
Example:
_execute("loadFromDB.bat");
So, as per the example, the second parameter is optional...
But do give it a try using the second parameter...
And the error message I get is:
Cheers
Donna
I script my batch files into two.
Compile.bat Run.bat And my script looked like This does the job for me, but if anyone knows of any neater solutions then I am more than willing to give them ago... or even explain why this solution works, but my original posting didnt work.
Cheers
Donna