One of the beauties of automated testing is that you can create a test plan for a long-running, repetitive test, then just send the whole thing over to a computer to carry out. Why do all that dreary, redundant work when an unpaid machine is more than happy to handle it for you, at considerably greater speed?
That's great, but wouldn't it be even better if you didn't have to be there to tell the machine to start the test? For one thing, many organizations need to run their automated tests during off-hours, when the load on the machines and the network won't interfere with the daily work of the staff. But who wants to hang around to start tests at all hours of the night? Wouldn’t it be nice if you could tell a system not only how to execute your tests, but when to execute them?
For example, say you want to run your regression test whenever a new build is released; you want it to run every night, again and again. And every morning, all you have to do is come in to work and open the result file.
Windows Task Scheduler is a system tool that allows you to schedule tasks, instructing the Windows operating system to launch those tasks at specific days and times, or even in response to specific events. TestArchitect also has a nice little tool called the command line tool, which allows you to launch tests from the command prompt, via batch files, rather than from the Execution Test dialog box. This TestArchitect tool enables you to run tests automatically from other programs – such as, of course, Windows Task Scheduler! Let’s see how we can use the combination of these two tools to achieve our ends:
- In TestArchitect client, select your test, then launch the Execute Test dialog box.
- In the dialog box, configure all the options as you normally would to execute your test in the manner you desire. Then, rather than clicking Execute, click Generate Batch File to create a batch file with your instructions and settings.
- In the Save dialog box that appears, browse to a location where you want to save the generated batch file:
- Click Save. The “Creation of batch file complete” message appears, indicating that the creating process is complete.
5. Click OK. The message box closes, along with the Execute Test dialog box.
Now that you have created the file of instructions telling TestArchitect how to executes your test, you need to tell your system when to execute the test.
6. Launch Windows Task Scheduler. (If your system doesn’t already have an icon for this application, the easiest way to do this is to open Windows Start Menu and start typing “task scheduler” into the Search box until the application appears.)
- Select Create Basic Task from the Action pane on the right of the window:
8. The Create Basic Task Wizard is launched. Begin by entering a Name and Description for your scheduled task, then click Next.
In the Trigger tab, you begin to establish your schedule for the when your test is to be run. Note that, depending on your selection, you are given additional options to further refine that schedule.
- In this case, let’s select Daily to run, then click Next:
- In the Daily tab, select the time at which you want to run your tests and click Next. Note that, with the Recur every box, you also have the option to reduce the frequency of your test runs from daily to every X number of days.
- In the Action tab, select Start a program and click Next
- In Start a Program, click Browse and locate the TestArchitect batch file that we created in Steps 2 - 4. Select the file and click Open, which returns you to the Create Task Wizard, then click Next.
- In the Finish tab, verify that the task is configured to your satisfaction, then click Finish. The wizard closes.
- Your newly-created task appears in Task Scheduler Library.
- Note that, from the Task Scheduler, you can edit your scheduled task at any time by double-clicking on it. That brings up the task’s Properties window, in which you may modify its various properties, including many that were not available in the wizard.
Bonus: you may want to check out article "Running Automated Tests Under Remote Desktop Session"