Schedule a test
At times, it might be impossible for you to manually run a cloud test at the time you want to.
You can schedule tests to run at fixed times and regular intervals. The particular reasons to schedule a test depend on use cases, but the broad motivations are usually as follows:
To test at inconvenient hours
For example, you might need to test a production system in the middle of the night, when traffic is lowest and all your developers are asleep.
To schedule once and run many times
For example, you might want regularly monitor for regressions (without integrating the test into your CI pipeline).
How to schedule a test
First, you need to select or create a test to schedule. Then, schedule it from the Scheduled tests page or from the page of the test itself.
Valid tests to schedule
If you have already authored the test, you can schedule it if it meets these criteria:
- It exists in your cloud account
- It has run on the cloud service (you can not schedule a locally run test through the web UI).
You can also use the web UI to create a test to schedule. Make sure you save your configuration.
After you have the test you want to schedule, you can schedule it in two ways.
Schedules overview page
In the sidebar menu, go to Manage > Scheduled tests.
On this page, you can create new schedules, and find and edit all test schedules your organization has created.
To schedule a test, select Add schedule, then follow these steps:
Select a project and a test. You cannot select a test that already has a schedule set up.
Set a
start date
andtime
.Toggle whether the test should repeat or run multiple times.
After you configure everything, select Add schedule.
You should see your newly created test schedule in the list of schedules.
Caution
When scheduling a test, the UI displays the local timezone based on your Grafana Cloud settings. However, Grafana Cloud k6 stores the test schedule in the UTC timezone, and doesn’t follow daylight savings time patterns, since they can vary by country or location.
If you are in a location that follows daylight savings time, and you want to make sure your test runs at the same time as your local time, you have to manually update your scheduled test twice a year.
Scheduling options
However you schedule your test, k6 provides the following options:
- When to run the test:
now
or at alater date
. - How frequently to repeat the test:
Hourly
,Daily
,Weekly
, orMonthly
.- If you choose weekly you can choose which days of the week to run the test.
- How many times the test will run: either _a set number, or stopping after a set date.
You can schedule tests with a high degree of granularity. So explore the options to find what works best for your case.
Next steps
After you schedule a test, you can automate further.
We recommend setting up notifications and thresholds.
With these, you can complete an automated loop—schedule your test to run automatically, then get automatically notified whenever it passes or fails.