When working with a hefty backlog of automated tests, launching those may be long-winded and take hours. One of the effective methods to resolve this problem is automatic launch of the tests when there is no one at work, and tests are not in anyone's way. This could be nighttime, weekends, or holidays. In this recipe, we will consider automatic launch of the tests every night.
In order to learn how to launch the executable tests from the command line, read the Running tests from the command line recipe.
In order to schedule test run, we need to perform the following steps:
starttc.bat
file with the following entrails:taskkill /f /t /im testcomplete.exe timeout /T 10 set TCPATH=C:Program FilesSmartBearTestComplete 9Bin "%TCPATH%TestComplete.exe" Z:TestCompleteCookBookTestCompleteCookBook.pjs /run /project:Chapter4 /exit
we will be launching this file by the schedule.
TestComplete Tests
), and click on the Next button.00:00:00
), and then click on Next.starttc.bat
file.TestComplete Tests
, and right-click thereon to further select the Run option.If everything has been properly done, the tests will be automatically launched for execution.
This task will be launched every night.
Since we cannot launch more than one copy of TestComplete, the first and foremost thing to do in the .bat
file is closing the respective process thread with the help of the taskkill
command, which is a part of Windows. This is done despite the possibility of TestComplete remaining open for some reason at the moment of the task's launch.
Further on, with the help of the standard timeout command, we await for 10 seconds. It is necessary to have all the resources duly released that are being utilized by TestComplete, or else upon successive launch we could run amuck with error messages. Depending on the speed of the computer, this parameter may be greater or lesser, nonetheless we recommend it be left at a greater value (for example, 30
seconds). Such an insignificant lag will have no impact on the timing of the test's execution, rather this parameter will not have to be customized each time against launches being transferred onto another computer.
Further more, with the help of the set
command, we create a TCPATH
variable, which will contain the pathway to the folder wherein TestComplete resides. This is optional, however the pathway can be signified fully in the following command, but then the command line could be long-drawn-out. In the last command, we launch the tests from the Chapter4
project up to execution. With the help of /exit
parameter, we signify that, having completed all the tests, TestComplete should close down.
3.135.183.138