cancel
Showing results for 
Search instead for 
Did you mean: 

Start next step only after batch file is complete

SOLVED
Highlighted
Occasional 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.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Community Leader

Re: Start next step only after batch file is complete

Quick ideas without delays

- Use errorlevel of batch file

- Use a file as a marker of batch finished

 

 

Un sourire et ça repart

View solution in original post

Highlighted
Staff

Re: Start next step only after batch file is complete

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

View solution in original post

5 REPLIES 5
Highlighted
Community Leader

Re: Start next step only after batch file is complete

Quick ideas without delays

- Use errorlevel of batch file

- Use a file as a marker of batch finished

 

 

Un sourire et ça repart

View solution in original post

Highlighted
Staff

Re: Start next step only after batch file is complete

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
Highlighted
Community Manager

Re: Start next step only after batch file is complete

Thank you everyone!

 

@kylegogtp was this helpful? Let us know🙂


Sonya Mihaljova
Community and Education Specialist
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Occasional Contributor

Re: Start next step only after batch file is complete

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);
}
Highlighted
Staff

Re: Start next step only after batch file is complete

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

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
Let's start July with new challenges!

Create a script to pass custom command-line arguments as a test parameter for the TechCorner tag!

Will you dare to take the challenge?


Top Kudoed Authors