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.
The test scheduling view is currently not available in Grafana Cloud. We are working on it.
Meanwhile, the Scheduled tests option redirects you to k6 Cloud (app.k6.io) to schedule your cloud tests from there.
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 on the top right, then follow these steps:
Select a project and test.
Toggle whether the test should repeat or run multiple times.
After you configure everything, select save Save schedule.
You should see your newly created test schedule in the list of schedules.
Test overview page
You can also schedule a test from the test overview page.
Navigate to your project and select the test.
On the test page, select Set up schedule.
This brings up the schedule configuration.
Tip: trigger a cloud test from the CLI, then set up a schedule from the cloud app to re-run the test on a regular interval.
However you schedule your test, k6 provides the following options:
When to run the test:
nowor at a
How frequently to repeat 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.
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.