我的测试套件只需要5秒才能启动,这是正常的吗?即使在运行空套件时,它仍然需要很长时间.是因为它在每次运行时都会启动一个新的rails实例吗?如果是这样,反正是否仍然坚持下去?
例:
rlepidi@rlepidi:~/projects/rails/my_project$time rake test /usr/bin/ruby1.9.1 -I"lib:test" "/var/lib/gems/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/release_test.rb" Loaded suite /var/lib/gems/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader Started Finished in 0.000181867 seconds. 0 tests,0 assertions,0 failures,0 errors,0 pendings,0 omissions,0 notifications 0% passed real 0m4.173s user 0m3.820s sys 0m0.288s
正如您所看到的,这个空测试非常快,但由于某些原因仍有4秒的开销.我正在使用Test :: Unit和Shoulda.