分析黄瓜测试 (ruby/rails)
与 Cucumber 测试相关的探查器/分析相关问题。
我们的一项黄瓜测试运行得相当慢。 我不想猜测我们的应用程序在哪里花费了时间,而是想以编程方式知道。
如何使用分析器触发黄瓜测试???
什么不起作用:
$ URL=/projects/by/114951412 #URL to slow rails page
$ script/performance/profiler 'app.get "$URL"' 50
这不起作用,因为“app.get”只能在控制台中工作,不适用于分析器脚本
$ EXPENSIVE_METHOD="Project.find('6300003243').aggregated_total_amount"
$ script/performance/profiler "$EXPENSIVE_METHOD" 50
这给出了结果,但我不得不猜测这个方法是瓶颈
(我正在使用黄瓜0.3.94, Rails 2.3.2,Ruby 1.8.7(2008-08-11 补丁级别 72)[i686-darwin9.6.0])
Profiler/profiling related issue with Cucumber testing.
One of our cucumber tests run fairly slow. In stead of guessing on where our application is spending time, I'd like to know programatically.
How do I trigger a cucumber test with a profiler???
What did not work:
$ URL=/projects/by/114951412 #URL to slow rails page
$ script/performance/profiler 'app.get "$URL"' 50
This does not work because 'app.get' only works in console and not available for profiler script
$ EXPENSIVE_METHOD="Project.find('6300003243').aggregated_total_amount"
$ script/performance/profiler "$EXPENSIVE_METHOD" 50
This gives a result but I have to guess that this method is the bottleneck
(I'm using cucumber 0.3.94, rails 2.3.2, ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.0])
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
还可以尝试使用 cucumber --format 来获取有关最慢步骤的一些统计信息。
Also try cucumber --format usage to get some stats about the slowest steps.
另一个实验实际上是对我的问题的答案,但没有给我但并没有真正给我一个特别有用的结果
这实际上运行了第36行的单个黄瓜场景,但结果不是特别有用
One more experiment is actually an answer to my question but did not give me but does not really give me a particularly useful result
This actually runs the single cucumber scenario on line 36, but the result is not particularly useful
使用 ruby-prof,您可以在主题代码之前启动探查器,并在主题代码之后再次停止。 例如。:
Using ruby-prof, you can start the profiler before the subject code and stop it again after. eg.: