Scheduled runs and auto-pause
A schedule runs your tests on a timer, so a break shows up before a user finds it.
A schedule runs your tests on a timer, so a break shows up before a user finds it. Each run is emailed to the people you list. A schedule that keeps failing pauses itself and tells its creator why.
What it is for
Use a schedule for a nightly full regression, or an hourly check of your core flows. A schedule targets one project or test list, in one environment, on one rule. The Schedules page lists every schedule with its status and its next run.
How it works
Monitoring has four layers. Each one hands off to the next.
- Schedule. The rule (hourly, daily, weekly, monthly or cron), the time zone, the optional end date and the recipients. When a run is due, the schedule starts it.
- Execution. The run is a normal run. HeyBug records its source as
scheduledand links it to the schedule, so it appears in that schedule's history. - Signal. When the run finishes, HeyBug stores it as the schedule's last run. It also updates the count of scheduled runs in a row without a passing run.
- Notification. Each recipient gets one result email per run. It has the counts, the failing cases with their failing step, and a link to the run. If the schedule pauses, the creator gets an email too.
Steps
- Open Schedules in the sidebar and click New schedule.
- Choose a project or test list, an environment, a rule and a time zone.
- Enter the recipients as a comma-separated list. Leave it empty if nobody needs the email.
- Save. The row shows Active and the next run time in the schedule's zone.
Auto-pause
A schedule that never passes stops firing by itself. HeyBug counts the scheduled runs in a row that do not pass. A run that passes resets the count to zero. An errored run counts as a run that did not pass.
When the count reaches 10 and the schedule is active, HeyBug:
- sets the schedule to paused,
- stores the reason, Paused after 10 runs without a pass,
- emails the creator with the schedule name in the subject.
On the Schedules page, that reason replaces the next run time on the schedule's row. A pause you make yourself shows User paused instead, and the count does not change.
Localhost rule
On the hosted app, a scheduled run cannot reach localhost, *.localhost or a loopback address. When the target is one of these, the run ends with this error:
Example
Set the server and token, then list your schedules. The token is read from the environment and is never printed.
export HEYBUG_SERVER=https://heybug.example.com
curl -s -H "Authorization: Bearer $HEYBUG_TOKEN" "$HEYBUG_SERVER/api/schedules"A schedule that has auto-paused comes back like this, trimmed to the useful fields:
{
"schedules": [
{
"id": "sch_...",
"name": "Nightly regression",
"status": "paused",
"pausedReason": "Paused after 10 runs without a pass",
"noPassStreak": 10,
"lastRunId": "run_..."
}
]
}To see the runs behind the count, list them:
curl -s -H "Authorization: Bearer $HEYBUG_TOKEN" "$HEYBUG_SERVER/api/schedules/$SCHEDULE_ID/runs"Each run has id, status, passed, total and createdAt. Open a run in the web app with the link in its result email.
What to do when it fails
- The schedule paused. Open the run links from the emails, or the runs list above. Fix the failing tests or the target. Then resume the schedule with the switch on its row, or with
POST /api/schedules/$SCHEDULE_ID/resume. - The schedule paused again straight after a resume. Resuming does not reset the count. The next run that does not pass pauses the schedule again at once. Fix the cause first. One passing run resets the count to zero.
- An email did not arrive. Check the recipients list and your server's mail settings. A failed send is logged as a warning and is not retried.
- The schedule is missing from the list. Check that you are in the workspace that created it. Schedules belong to one workspace.