HootyMcOwlFace's avatar
Regular Visitor
2 years ago
New Idea

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's avatar
    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)