Skip to content

Run the backend test suite

Conventions for writing specs are in Backend testing. This page covers CI, parallel runs and local browser setup for the Easy8 team.

CI

GitLab CI runs the specs on every pushed commit. The pipeline is defined in .gitlab-ci.yml. Specs without an explicit type: run in the CI others job.

Parallel execution

Use parallel runs for large parts of the suite. Complete the one-time setup in Parallel RSpec setup first.

Run all unit tests (feature specs excluded) with 6 workers, the default of the rake task (lib/tasks/rspec_parallel.rake):

bundle exec rake rspec:parallel:unit

Set another worker count with an argument or with PARALLEL_TEST_PROCESSORS:

bundle exec rake "rspec:parallel:unit[8]"

Run one directory in parallel:

./bin/parallel_rspec easy_engines/easy_extensions/spec/models

Parallel runs cut the full unit suite from about an hour to roughly 10-15 minutes on a multi-core machine.

Feature specs in a browser on macOS

Feature specs use Chrome through Selenium. On macOS install chromedriver and remove its quarantine flag:

brew install --cask chromedriver
xattr -d com.apple.quarantine chromedriver

To use another Chromium-based browser, add the path of its binary to the :selenium_chrome driver registration in spec/capybara_config.rb:

options.binary = "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"