2

I am currently trying to follow performance testing tutorial given in Ruby on Rails docs. But I got stuck in the first step itself!

When I try to run the command given below i get an error,

Command:

$ rails generate performance_test homepage

Error I get:

Could not find generator 'performance_test'. Maybe you meant 'integration_test', 'resource_route' or 'coffee:assets'

I ran "rails generator --help" to see the possible files that can be generated and below is the output I got for that,

Running via Spring preloader in process 9465
Expected string default value for '--jbuilder'; got true (boolean)
Usage: rails generate GENERATOR [args] [options]

General options:
  -h, [--help]     # Print generator's options and usage
  -p, [--pretend]  # Run but do not make any changes
  -f, [--force]    # Overwrite files that already exist
  -s, [--skip]     # Skip files that already exist
  -q, [--quiet]    # Suppress status output

Please choose a generator below.

Expected string default value for '--helper'; got true (boolean)
Expected string default value for '--assets'; got true (boolean)
Rails:
  assets
  channel
  controller
  generator
  helper
  integration_test
  jbuilder
  job
  mailer
  migration
  model
  resource
  responders_controller
  scaffold
  scaffold_controller
  task

Coffee:
  coffee:assets

Js:
  js:assets

RailsScript:
  rails_script:class
  rails_script:controller
  rails_script:element
  rails_script:install
  rails_script:utility

Responders:
  responders:install

Rspec:
  rspec:controller
  rspec:feature
  rspec:helper
  rspec:install
  rspec:integration
  rspec:job
  rspec:mailer
  rspec:model
  rspec:observer
  rspec:request
  rspec:scaffold
  rspec:view

SimpleCalendar:
  simple_calendar:views

TestUnit:
  test_unit:controller
  test_unit:generator
  test_unit:helper
  test_unit:integration
  test_unit:job
  test_unit:mailer
  test_unit:model
  test_unit:plugin
  test_unit:scaffold

As seen above, a performance test unit is not defined there. Is this the case in RoR 5, or have I messed up the project and thereby not able to generate performance_test files?

1 Answer 1

5

Rails 4 removed performance_test from being a default. You can see in the Rails doc link you provided, it is for Rails 3.2.x

From https://github.com/rails/rails-perftest

As of rails 4 performance tests are no longer part of the default stack.

On their github page there are instructions for adding it back, here are the relevant gems.

gem 'rails-perftest'
gem 'ruby-prof'
1
  • Thank you! I cannot up vote your answer yet as I'm a newbie. Also, I did see that the doc was for 3.2.x but I got the same doc even when I searched for Rails 5. May 11, 2017 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.