目前,我正在运行超过1k个示例,并且需要很长时间才能完成(超过20 minutes!!!个).
我想确定哪些示例需要更多的时间来完成,有没有办法运行rspec并返回每个示例(单独)完成所需的时间?我用rspec 1.3.0和rspec-rails 1.2.3
目前,我正在运行超过1k个示例,并且需要很长时间才能完成(超过20 minutes!!!个).
我想确定哪些示例需要更多的时间来完成,有没有办法运行rspec并返回每个示例(单独)完成所需的时间?我用rspec 1.3.0和rspec-rails 1.2.3
您可以使用评测列出10个最慢的示例:
spec -p spec/*/*_spec.rb --colour --format profile
如果你在一个特定的测试套件上运行这个测试,你可以从一个较小的示例子集中得到10个最慢的示例:
spec -p spec/models/user_spec.rb --format profile
对于较新版本的rspec,您应该使用--profile
选项:
rspec spec/ --profile | (shows the 10 slowest examples)
rspec spec/ --profile 2 | (shows the 2 slowest examples)