rails-perftest icon indicating copy to clipboard operation
rails-perftest copied to clipboard

Is there a way to avoid executing test:prepare?

Open viccarrasco opened this issue 10 years ago • 2 comments

I need to test the performance of my website with real data, I wont spend the time creating millions of fixture records to do this, so is there a way to test my application with a copy of my production data without having it replaced by fixtures? I've tried creating a new benchmark environment for my rails app with numerous tutorials and none have worked. Is there a way to do this?

viccarrasco avatar Sep 22 '15 18:09 viccarrasco

I think that it could be a simple change, I'll check it out. As of right now, you can create a rake task for 'test:prepare' so that it doesn't break.

MixmasterFresh avatar Sep 28 '15 19:09 MixmasterFresh

@Sapherous This might be a little late for you, but I just went through this exercise myself, mostly based on these instructions: http://tekin.co.uk/2014/09/performance-test-rails-against-real-data/ I'm running rails 4.2.4

I modified the author's rake task to look like this:

# lib/tasks/test_benchmark.rake
# Use this rake task to run performance tests against the "benchmark"
# environment. See test/benchmark_helper.rb for more details.
namespace :test do
  Rake::TestTask.new(:real_world_benchmark => ['test:perftest:benchmark_mode', 'test:real_world_profile']) do |t|
  end

  Rake::TestTask.new(:real_world_profile) do |t|
    t.libs << 'test'
    t.pattern = 'test/performance/**/*_test.rb'
  end
end

Otherwise, most of the other setup worked as is, and I can now run bundle exec rake test:real_world_benchmark against my development database.

One other gotcha I ran into was that I had to add :benchmark to the [:development, :test] group in myGemfileand make sure that rails-perfest and ruby-prof were included.

sebboh avatar Nov 18 '15 23:11 sebboh