Skip to content

Instantly share code, notes, and snippets.

@chrisroos
Created May 14, 2015 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisroos/7ed65bb2402e5c162b43 to your computer and use it in GitHub Desktop.
Save chrisroos/7ed65bb2402e5c162b43 to your computer and use it in GitHub Desktop.
Exploring Minitest's parallelize_me! option

Intro

Testing the parallelize_me! option of Minitest.

Without parallelisation

$ ruby parallelisation_test.rb
Run options: --seed 65190

# Running:

....................................................................................................

Finished in 20.306983s, 4.9244 runs/s, 9.8488 assertions/s.

100 runs, 200 assertions, 0 failures, 0 errors, 0 skips

With parallelisation

$ PARALLELIZE=true ruby parallelisation_test.rb
Run options: --seed 22103

# Running:

....................................................................................................

Finished in 10.153597s, 9.8487 runs/s, 19.6975 assertions/s.

100 runs, 200 assertions, 0 failures, 0 errors, 0 skips
source 'https://rubygems.org'
gem 'minitest'
GEM
remote: https://rubygems.org/
specs:
minitest (5.6.1)
PLATFORMS
ruby
DEPENDENCIES
minitest
require 'bundler/setup'
require 'minitest/autorun'
class ParallelisationTest < Minitest::Test
parallelize_me! if ENV['PARALLELIZE']
def setup
@name = 'bob'
end
1.upto(100).each do |count|
define_method("test_#{count}") do
assert_equal count, count
assert_equal 'bob', @name
sleep 0.2
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment