How to find which rspec test is taking so long

百般思念 提交于 2019-12-20 08:16:20

问题


One (or a couple) of our tests are taking forever and we'd like to optimize them.

We have say 1000 tests so it's impractical for me to go through run each file.

Is there an easy to way to find the slow ones?

This is rspec 1.3


回答1:


In RSpec 2 and 3, you can use the --profile flag or add --profile to your .rspec file. This will track the top 10 slowest examples.

For RSpec 1, you can use --format o with spec command. It shows a text-based progress bar with profiling of 10 slowest examples. For more details see this.

rspec --profile -- path/to/file/spec.rb


来源:https://stackoverflow.com/questions/6946303/how-to-find-which-rspec-test-is-taking-so-long

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!