- Normal Rails setup: 30 seconds for
rake test
- Using 1.9.3-falcon: 22 seconds
- Using merged task w/ db reset: 16 seconds
- Using merged task w/o db reset: 12 seconds
- Using raw ruby execution: 9 seconds
You can run rake test:fast:db
to get a merged run that resets your db. However, if you have clean tests that don't pollute the db between runs, you can just run rake test:fast
and it will omit db:reset. This means your sequence numbers (under PostgreSQL, at least) may keep increasing, but if you tests against those I have other words for you.
xoxo <3 <3 <3 @ngauthier
I think you may run into problems trying run the tests in the context of the rake task, since at that point Rails has already loaded (
MyApp::Application.load_tasks
) without being in the test env — normally the first thing the sub-process does is loadtest_helper.rb
, which definesENV['RAILS_ENV'] = 'test'
at the top.If you're not using the rake dependencies or other niceties, you can instead bypass rake altogether. In the end, Rake essentially just requires all the files sequentially, so you can just wrap that in a small script. Here's some quick benchmarks with that approach: https://gist.github.com/1839453