Ask a Question

Get and Evaluate Response of Batch-Script as Tested App

Get and Evaluate Response of Batch-Script as Tested App

In some cases it is useful / necessary to run a batch script from Testcomplete. Unfortunately Testcomplete can't get back the status code from the batch file to get the information if the script was executed successful or not. In many cases it would be useful to get back the status code at the keyword level of Testcomplete, for example:

- execute a program to do some taks as pre condition for the following teststeps

- execute some testcases with a batch file that can't be executed by Testcomplete directly, like python testcases with the pytest framework

 

1 Comment
Lee_M
Community Hero

%ErrorLevel% is returned from the script, it would be nice if TestComplete could wait for this value

 

 

I have found a way to wait until the script has finished but not return the error code

 

insert this code into your script (and then remove it after you get the process name)

"timeout 300"

go into the object browser and get the process name, in my case Sys.Process("cmd", 2);

 

 

I wrote this little function to pause the test until the script has finished

 

 

function test_runTestedApp (){
var pName = Sys.Process("cmd", 2);
 while (pName.Exists == true) {
  Log.Warning("Exists = " + pName.Exists)
 }
 Log.Message("process has finished :: " + pName.Exists)
}

Announcements
Welcome to the TestComplete Feature Requests board!

Here you can review submitted feature requests and vote up the ones you like! If you can't find the feature you want - go ahead and suggest your own idea. Ideas with the highest rating can be implemented in the product.

Check out the Create a Feature Request guide for more information.
New Here?
Welcome to the Community
Sign Up Here