Ask a Question

Start next step only after batch file is complete

SOLVED
kylegogtp
Contributor

Start next step only after batch file is complete

I am looking for a way (without using delays) to only start the next step in the test only if the previous step batch file has completed.

5 REPLIES 5
BenoitB
Community Hero

Quick ideas without delays

- Use errorlevel of batch file

- Use a file as a marker of batch finished

 

 

Un sourire et ça repart

as @BenoitB says above, you need a marker of whatever process to indicate that the batch file has finished.

so whatever you are doing with the batchfile, I'm assuming there is a clear indicator of whatever process to have ran (or do whatever its supposed to do)

Then you can use the name mapping objects and their properties to find that same property, and provide it the conditional logic so that the next step continues on only after that one property is met. just a quick idea

Best,
Justin Kim
sonya_m
SmartBear Alumni (Retired)

Thank you everyone!

 

@kylegogtp was this helpful? Let us know🙂


Sonya Mihaljova
Community and Education Specialist

Using a batch to create a file to mark it. But what would be the best way to have Testcomplete wait to check the existence of the file? The batch time to run can be variable especially on different computer builds, so I will need it to check continuously until file is there.

 

I found this script that might work. I cannot use absolute paths because the folder location of source control can vary for machines as well.

 

function FileExistsExample()
{
  var sPath;
  sPath = "c:\\MyFile.txt";
  
  if (! aqFileSystem["Exists"](sPath))
    aqFile["Create"](sPath);
  aqFile["WriteToTextFile"](sPath, "Hello, world!" + "\r\n", aqFile["ctANSI"], false);
}

if you are using source control to pull the TC files to run, and you cannot define the absolute path, maybe you can use the dynamic properties like 

sPath = project.path + "\\myBatch\\MyFile.txt"

https://support.smartbear.com/testcomplete/docs/reference/project-objects/project/project/path.html

if you include the batch file as a part of the repo you are pulling down?

Best,
Justin Kim
cancel
Showing results for 
Search instead for 
Did you mean: