剖析黄瓜测试(红宝石/铁轨)

Jes*_*sen 4 testing profiler profiling ruby-on-rails cucumber

Profiler/profiling与黄瓜测试有关的问题.

我们的一个黄瓜测试运行相当缓慢.我不想猜测我们的应用程序花费时间在哪里,我想以编程方式知道.

如何使用分析器触发黄瓜测试???

什么没有奏效:

  $ URL=/projects/by/114951412 #URL to slow rails page
  $ script/performance/profiler 'app.get "$URL"' 50
Run Code Online (Sandbox Code Playgroud)

这不起作用,因为'app.get'仅适用于控制台,不适用于探查器脚本

  $ EXPENSIVE_METHOD="Project.find('6300003243').aggregated_total_amount"
  $ script/performance/profiler "$EXPENSIVE_METHOD" 50
Run Code Online (Sandbox Code Playgroud)

这给出了结果,但我不得不猜测这种方法是瓶颈

(我使用黄瓜0.3.94,导轨2.3.2,红宝石1.8.7(2008-08-11补丁级别72)[i686-darwin9.6.0])

Asl*_*søy 8

还可以尝试使用cucumber --format用法来获取有关最慢步骤的统计信息.

  • 仅供参考,它看起来像`--format profile`现在已经被重命名为`--format usage`. (8认同)