In Rails, you can run rake test:units, rake test:functionals, and rake test:integration which run the tests in ./test/unit, ./test/functional, and ./test/integration, respectively. You can also run rake test, which runs all three.

But rake test runs all three one after another—I’ve always wondered why—so you pay the cost of loading the test suite (and Rails) three times.

It’s not hard to run unit, functional, and integration tests all at once (although I had a couple of false starts). Here’s a test:all task that does the trick:

require 'rbconfig'
require 'rake/testtask'

namespace :test do
  Rake::TestTask.new(:all => "test:prepare") do |t|
    t.libs << "test"
    t.test_files = %w{unit functional integration}.map { |dir| Dir.glob("test/#{dir}/*_test.rb") }.flatten
  end
end