Ruby Raider

Scheduling tests

Raider can run your tests on a schedule, for example every weekday at 08:00, even when Raider Desktop is closed. A scheduled run is an ordinary run of your tests, and its results show on the Dashboard. You choose what runs, when, and whether you see the browser.

Scheduling needs a project on ruby_raider 4.2 or later. On an older project, the Schedules panel says "Scheduling needs ruby_raider 4.2 or later." To update, run bundle update ruby_raider in the project folder.

Choose what to run

A schedule runs one of these:

To tick tests, press Select at the top of the Tests list on the Tests tab. Each test gets a checkbox, and clicking a test ticks it instead of opening it. Shift-click ticks every test in between. The bottom of the list shows how many are ticked, such as "2 ticked", with Run to run them now, Schedule… to schedule them and Clear to untick them all. Press Select again, or Esc, to go back to opening tests.

A schedule of ticked tests remembers their files. Renaming a test keeps it in the schedule; deleting its file does not (see When a scheduled run fails).

Schedule tests

On the Tests tab, open the Schedules panel and press Schedule…, or press Schedule… under the ticked tests. Then fill in:

Press Schedule, and the schedule shows in the panel with when it runs, such as "Every weekday at 08:00", and its next run. With Notify me when a scheduled run fails on, the row also says "notify on failure".

Your computer's own scheduler runs the tests, so nothing needs to stay open and nothing asks for an admin password. Schedules belong to this computer: they are kept out of git, and a fresh copy of the project has none.

Show the browser

Scheduled runs hide the browser unless you turn on Show the browser for that schedule. It works whatever the project's Headless setting on the Files tab says, and it never changes that setting: the run itself tells the browser to show.

Next run, last result and reports

Each schedule in the Schedules panel shows its name, what it runs (All tests, a tag, or how many tests), when it runs, "browser shown" when Show the browser is on, the next run, and the last result:

A new schedule shows "Not run yet".

The buttons on each schedule:

A scheduled run is an ordinary run of your tests, so it replaces the last run on the Dashboard, as a run from the app does; see Dashboard. The report on the schedule stays until that schedule runs again.

Only one run goes at a time in a project. While a scheduled run is going, the app does not start another run and says "A scheduled run (nightly) is going; try again when it finishes." A scheduled run that is due while another run is going is skipped and leaves the Dashboard alone.

When a scheduled run fails

With Notify me when a scheduled run fails on, your computer shows a notification when a scheduled run fails or could not start, with Raider Desktop open or closed. Its title names the schedule, such as "Ruby Raider: nightly failed", and it says how many tests failed, such as "3 of 40 tests failed", or why the run could not start. Passed and skipped runs never notify.

With it off, you get a notification, "Scheduled run failed", only while Raider Desktop has the project open. Clicking it opens the Tests tab with the Schedules panel.

If a schedule did not run, or its row shows a warning:

On each computer

Your computer's own scheduler runs the schedules:

On Linux the failure notification often can't show under cron, or in a systemd session without your desktop's session bus.

A schedule runs your tests with the Ruby that was active when you made it. After you upgrade or move Ruby, schedule them again.

Each schedule is tied to the project's folder. Stop its schedules before you move or rename the folder, then schedule them again in the new place.

From the command line

Everything in the Schedules panel is also a Ruby Raider command. Run it in the project folder, or add --project PATH at the end. raider sc is short for raider schedule.

Command What it does
raider schedule add NAME --every day --at 02:00 Schedules all tests, or replaces the schedule NAME.
raider schedule add NAME --every day --at 02:00 --tag smoke Schedules the tests tagged smoke.
raider schedule add NAME spec/a_spec.rb spec/b_spec.rb --every day --at 02:00 Schedules those test files.
raider schedule list Lists the schedules with their next run, last result and state.
raider schedule run NAME Runs the schedule now, the way the scheduler does. It counts as the schedule's last result and notifies like a scheduled run.
raider schedule remove NAME Removes the schedule.

add takes --every hour, day, weekday or week, --at 08:00 (or --at :15 for every hour), --on mon to sun for every week, --show-browser, --retries N (0 to 3) and --notify. For example:

raider schedule add nightly --every day --at 02:00 --notify
raider schedule add smoke --every hour --at :15 --tag smoke --retries 1

add checks the project first. A project locked to an older ruby_raider is refused with "Scheduling needs ruby_raider 4.2.0 or later in this project: bundle update ruby_raider".

raider schedule run ends with one of these exit codes:

The other commands end with 0, or with 2 and one line saying why. A mistyped command, such as a missing NAME, ends with 1 and the usage text. The Ruby Raider README has every option.

Upgrading from 4.1

Schedules made with Ruby Raider 4.1 can't run in 4.2. They are removed automatically the first time any raider schedule command runs in the project, or the next time one of them is due, and one line says which were removed. Add them again with raider schedule add.

Apart from the old list of schedules, nothing is deleted: the folders that 4.1 schedules used are left alone; the Ruby Raider README says which ones you can delete and when, and how to remove the schedules of a project you moved.