在一个新的Rails项目中,Minitest的运行速度很慢:
首先我设置Spring binstubs:
david$ bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted
接下来,我通过Spring运行默认测试(navigation_test.rb):
david$ time bundle exec spring rake test
Run options: --seed 32313
# Running:
.
Finished in 0.003368s, 296.9121 runs/s, 296.9121 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
real 0m5.171s
user 0m0.581s
sys 0m0.098s
接下来的运行速度略快,但仍然很慢(大约3秒):
david$ time bundle exec spring rake test
Run options: --seed 48522
# Running:
.
Finished in 0.003506s, 285.2253 runs/s, 285.2253 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
real 0m3.159s
user 0m0.579s
sys 0m0.088s
如果我在没有捆绑器的情况下再次运行它,它会更快一些:
david$ time spring rake test
Run options: --seed 55025
# Running:
.
Finished in 0.003413s, 292.9974 runs/s, 292.9974 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
real 0m2.677s
user 0m0.087s
sys 0m0.032s
任何使用Minitest + Spring的人?如何让它跑得更快?
使用Rails 4.1.1
答案 0 :(得分:0)
设置spring和binstub后,没有理由继续调用bundler。试试这个:
$ time bin/rake test