multitest
Caveats
Multitest is still very young, it is in active development and is no where near complete or robust.
Multitest currently only works in a rails environment. It’s only because I use “constantize”.
If you depend on fixture data in your database, you may have data inconsistency errors. I like to use an empty DB and then use factories with transactional tests, and this runs great.
Installation
You will need to have Gemcutter in your list of gem sources.
gem install multitest
Usage
in your Rakefile:
require 'multitest'
require 'multitest/tasks'
on the commandline:
rake multitest
rake multitest:units multitest:functionals multitest:integration
Configuration
in your Rakefile:
Multitest.cores = 8
Benchmarks
This is one of our largest apps.
Normal suite
time rake test
259.03user 27.50system 5:14.76elapsed 91%CPU
2 Cores
time rake multitest
213.86user 23.38system 2:41.24elapsed 147%CPU
4 Cores
time rake multitest
223.18user 24.53system 2:08.96elapsed 192%CPU
Note the wall-time differences of 5:14 vs 2:41. 195% speedup on two cores. On 4 cores there is only a speedup of 243%, but that’s still quicker. If you send me impressive benchmarks, I’ll be happy to put them up here (8 cores anyone?).
Require Errors
If you get require errors like:
Running multitest:units
rake aborted!
no such file to load -- test_helper
Then you may want to use more absolute paths in your tests. For example, if you had:
# test/unit/my_class.rb
require 'test_helper'
class MyClass < ActiveSupport::TestCase
end
You should change it to:
# test/unit/my_class.rb
require File.join(File.dirname(__FILE__), '..', 'test_helper')
class MyClass < ActiveSupport::TestCase
end
Note on Patches/Pull Requests
-
Fork the project.
-
Make your feature addition or bug fix.
-
Add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
-
Send me a pull request. Bonus points for topic branches.
Copyright
Copyright © 2009 Nick Gauthier. See LICENSE for details.