Classic Docs
Docs Navigation

Running tests in parallel

This document explains how to run your test suite in parallel. You can either manually set up parallelization for your test suite, or use Boosters to let Semaphore automatically parallelize your Rails test suite.

For every CI job, Semaphore checks out and runs your code inside an isolated container or virtual machine, called Box. Boxes are powerful, isolated CI job runners engineered to provide bare metal performance at the convenience of cloud.

Boxes of the same Semaphore project cannot communicate with each other. One way for sending data to a single Box or sharing the same data among multiple Boxes of the same Semaphore project is with the use of Configuration Files.

Use your boxes to parallelize a large test suite, or build and deploy multiple branches across different projects. Semaphore does not limit how you use your boxes in any way.

To split your test suite into parallel jobs, simply rearrange your build commands for multiple jobs in your project's settings.

Instructions below should help you manually parallelize your test suite. If you’re parallelizing a Rails application, you can try Semaphore Boosters which can automatically split your RSpec or Cucumber test suite.

Let's assume that you have a Ruby project with a test suite composed of RSpec and Cucumber. In addition to that, you also have a number of JavaScript tests for the front end. Your build settings might look similar to this:

Here's what you need to do to run RSpec, Cucumber and JavaScript tests in parallel. First, add a new "Parallel job" near the bottom of the screen:

A new job block will appear, with an input field to enter a build command. Since in this example all the commands we want to run have already been entered, we'll press the Escape key, and drag and drop the bundle exec rake cucumber command into our new job:

You can now rename the job from "Job #2" to "Cucumber" in order to be able to differentiate between jobs more easily later. This text will also appear on the pages showing build results. To rename the job, click on "Rename" next to "Job #2", enter your prefered name, and press Return.

Repeating the same for npm test gives us a 3-job setup, as shown on the following screenshot:

From this point on, all new builds will run in three parallel jobs — faster than if all tests ran sequentially, i.e. one by one. Note that the total build time duration is now determined by the longest running job.

# See also

Semaphore Docs are open source — Edit on GitHub


Occasional lightweight product and blog updates. Unsubscribe at any time.

2009-2019 © Rendered Text. All rights reserved. Terms of Service, Privacy policy, Security.