An important part of test automation is the ability to schedule tests to be run over and over at a certain interval or be triggered by certain events. For instance, some production health checks might need to be run every 5 or 10 minutes around the clock, while other functional tests should be run only when a new version of some software has been deployed to a test environment.
The Scheduler is the core component of the LEAPWORK Automation Platform that enables you to do all that.
Creating a Schedule
The following is an example of how to setup a schedule that can be run either at a certain interval or run ad hoc, for instance to be later triggered by a call to the REST API.
Step 1: Open LEAPWORK Studio on your own computer an
d go to the "Scheduling" screen.
Step 2: Click "New"
Step 3: Fill in a title and optionally a description for the schedule.
Step 4: The schedule is enabled by default, so it will start running as soon as you click "Save". If you wish to disable it and then enable it later, uncheck the "State" checkbox.
Step 5: Click the "Schedule" tab.
Step 6: Choose between "Ad-hoc" and "Scheduled" run types.
"Ad-hoc" means the schedule will not be run unless someone explicitly clicks the "Run Now" button or triggers it to run through the REST API.
In this example, we have chosen "Scheduled".
Step 7: Select which weekdays the schedule is allowed to run, as well a run window (from/to times during each weekday).
Step 8: Select how the schedule runs should be repeated.
Choose between "No repeat" which means the schedule will only be run once, "Repeat every x minutes" which as the name says repeats the schedule every x minutes, and "Start right after last run" which means the schedule will be run in an endless loop.
Step 9: Decide if a repeat should be skipped if the last run hasn't finished yet.
If you have a schedule that is set to repeat every 30 minutes, but once in a while a single run takes more than 30 minutes, this checkbox can help you avoid overlaps.
Step 10: Decide if a schedule run should be stopped if it has run for more than x minutes. This can be relevant in situations where you have very long-running test cases, but still want to cap them at for instance 24 hours (1440 minutes).
Step 11: Click "Cases to run" to select which cases from which project this schedule should run.
Only cases from one project can be run in any one schedule.
Step 12: Click "Environments" and select which environments the schedule should be run on (one or more).
You can read more about how to use environments here.
Step 13: If more than one environment is selected, you can select whether to run all cases on all environments or only run each case once.
The latter option ("Run Cases Once") is useful if for instance you have multiple identical environments, such as cloud servers, where the test cases can run in parallel.
Step 14: Click "Actions"
Schedules can include "scheduled actions" that are executed after a scheduled run is completed, but only if a certain condition is met.
This can for instance be used to send an email to one or more recipients when a certain number of cases are failed during a run.
It can also for instance be used to send the entire results of a scheduled run to a script or a REST API endpoint, thereby pushing the results into a third-party Application Life-cycle Management (ALM) system.
The possibilities for integrating LEAPWORK into other software and business processes with scheduled actions are many.
Step 15: Optionally add a scheduled action, for instance sending an email when a scheduled run is completed.
Note: If you select an action that sends email, make sure you have configured an SMTP server in the "Settings" section. If you are unsure about how to configure SMTP, ask your network administrator or contact firstname.lastname@example.org and we'll do our best to help get you up and running.
Step 16: Click "History" to see a list of events that have happened in relation to this schedule.
The list will be empty for new schedules, but as soon as it has been run once, the history list can be a good source for troubleshooting information.
Step 17: Click "Save".
The schedule will now be created and, if enabled, be queued for execution as soon as possible.
Step 18: You can optionally click "Run Now" to queue to schedule for immediate execution.