I want to optimise a test suite. First I need to know where the time is being spent. As a minimun I want to know how much time is spent in each test.
我想优化测试套件。首先,我需要知道花费的时间。作为最小化,我想知道每次测试花费了多少时间。
I came across this gem https://github.com/timocratic/test_benchmark
but is no longer maintained.
我遇到了这个宝石https://github.com/timocratic/test_benchmark但不再维护了。
Notice that my goal is to benchmark the test suite, not the application.
请注意,我的目标是对测试套件进行基准测试,而不是应用程序。
Is there any other gem that I could use?
我还可以使用其他宝石吗?
- Rails
- Rspec
- Capybara
2 个解决方案
#1
8
Rspec has a minimum functionality profiler included. Have you looked at it? (blog post tutorial for rspec1 but still valid for rspec2)
Rspec包含最小功能分析器。你看过了吗? (rspec1的博客文章教程,但对rspec2仍然有效)
Basically, if you specify -p
then you get a list of the slowest 10 tests.
基本上,如果指定-p,则会获得最慢的10个测试的列表。
#2
4
Are you familiar with the unix time command? If you're just looking to see how long your test suite took to run you can just prepend the time commmand:
你熟悉unix time命令吗?如果您只是想看看测试套件运行了多长时间,您可以先添加时间命令:
time rake spec
After your rspec output you should see something like
在您的rspec输出后,您应该看到类似的东西
Finished in 5.31 seconds
195 examples, 0 failures, 27 pending
real 0m26.580s
user 0m14.085s
sys 0m2.168s
Of course, this is assuming you're on a *nix platform :-)
当然,这是假设你在* nix平台上:-)
-a
#1
8
Rspec has a minimum functionality profiler included. Have you looked at it? (blog post tutorial for rspec1 but still valid for rspec2)
Rspec包含最小功能分析器。你看过了吗? (rspec1的博客文章教程,但对rspec2仍然有效)
Basically, if you specify -p
then you get a list of the slowest 10 tests.
基本上,如果指定-p,则会获得最慢的10个测试的列表。
#2
4
Are you familiar with the unix time command? If you're just looking to see how long your test suite took to run you can just prepend the time commmand:
你熟悉unix time命令吗?如果您只是想看看测试套件运行了多长时间,您可以先添加时间命令:
time rake spec
After your rspec output you should see something like
在您的rspec输出后,您应该看到类似的东西
Finished in 5.31 seconds
195 examples, 0 failures, 27 pending
real 0m26.580s
user 0m14.085s
sys 0m2.168s
Of course, this is assuming you're on a *nix platform :-)
当然,这是假设你在* nix平台上:-)
-a