Junior Track Roadmap

Testing: parallel tests

This app's RSpec suite has 205 spec files and 1,219 examples. It runs in one process in about 1 minute 19 seconds. The course asks whether running it in parallel would help. It reads Minitest's built-in ActiveSupport::TestCase.parallelize and explains why it has nothing to run here. It then covers the separate parallel_tests gem for RSpec and how it groups spec files by size or runtime. The TEST_ENV_NUMBER database convention follows, then a cost analysis and a small plain-Ruby load-balancing challenge.

What you'll learn

  • ✓How Minitest's parallelize works with processes, threads and its 50-test threshold
  • ✓Why rspec-core has no parallel runner and what the parallel_tests gem adds
  • ✓How parallel_tests groups whole spec files by filesize or runtime
  • ✓The TEST_ENV_NUMBER convention for one test database per process
  • ✓How to weigh fixed costs like file loading and database setup against time saved
Free preview · Lesson 1 3 min read

This app's spec suite, timed, runs in one process

That's this app's spec suite, run for this course: 205 spec files and 1,219 examples. RSpec reports 1 minute 19.03 seconds of run time. Loading the files beforehand, requiring every spec, factory and support file before a single example runs, took another 2.87 seconds. Every number in this course…

Read the full lesson free →

Curriculum

7 lessons
Type to start searching...