【问题标题】:No expected output for my performance testing我的性能测试没有预期的输出
【发布时间】:2011-10-03 12:59:27
【问题描述】:

我想对我的 rails 3 应用程序进行性能测试,并根据 rails 在线指南进行了尝试

rake test:profile

它给出了一些输出:

Specify ruby-prof as application's dependency in Gemfile to run benchmarks.
Loaded suite /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/rake_test_loader
Started
.
Finished in 0.326233 seconds.

1 tests, 0 assertions, 0 failures, 0 errors, 0 skips

但根据指南,应该是这样的:

BrowsingTest#test_homepage (31 ms warmup)
           wall_time: 6 ms
              memory: 437.27 KB
             objects: 5,514
             gc_runs: 0
             gc_time: 19 ms

还有一些在应用程序的 tmp/performance 目录中生成的日志文件,在我的情况下不存在。

性能测试是在我的应用的 test\performance 目录中生成的示例测试,browser_test.rb:

require 'test_helper'
require 'rails/performance_test_help'

# Profiling results for each test method are written to tmp/performance.
class BrowsingTest < ActionDispatch::PerformanceTest
  def test_homepage
    get '/'
  end
end

我的 rails 版本是 3.0.10。谁能给我一些提示或提示?

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 performance-testing


    【解决方案1】:

    遇到了同样的问题,通过运行解决了

    rvm install 1.9.2-p290 --patch gcdata # Make sure you have the same patch version
    

    (注意:由于我出现错误,不确定该步骤有多大帮助,但因为这是我所做的一部分......)

    添加到我的 gemfile

    gem 'ruby-prof', :git => 'git://github.com/wycats/ruby-prof.git'
    gem 'test-unit'
    

    当然还有跑步

    bundle install
    

    一些对我有帮助的阅读材料

    【讨论】:

    • 嘿,您的解决方案适用于我的问题!非常感谢!顺便说一句,我没有添加那个 pacth,只安装了两个 gem,虽然我不知道为什么我必须安装 'test-unit' 才能使 'ruby-prof' 正常工作。
    • 很高兴我能帮上忙 :)。现在,guides.rubyonrails.org 中提到的基准辅助方法有另一个问题。他们不会在我的日志中输出任何内容...
    猜你喜欢
    • 1970-01-01
    • 2019-08-25
    • 1970-01-01
    • 2012-04-05
    • 1970-01-01
    • 1970-01-01
    • 2018-09-18
    • 2019-09-07
    • 1970-01-01
    相关资源
    最近更新 更多