diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-06-13 00:21:03 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-06-14 02:04:38 -0700 |
commit | eab71208db1afead6803501c8d51d77625e5ad6e (patch) | |
tree | 194e4911a90e5edf7af4c3c2990d6c0ad3645791 /railties | |
parent | ba0f38f89e8473490270957849d7d5b06f6ee65b (diff) | |
download | rails-eab71208db1afead6803501c8d51d77625e5ad6e.tar.gz rails-eab71208db1afead6803501c8d51d77625e5ad6e.tar.bz2 rails-eab71208db1afead6803501c8d51d77625e5ad6e.zip |
Performance: integration test benchmarking and profiling. [Jeremy Kemper]
Diffstat (limited to 'railties')
-rw-r--r-- | railties/helpers/performance_test.rb | 11 | ||||
-rw-r--r-- | railties/lib/rails_generator/generators/applications/app/app_generator.rb | 2 | ||||
-rw-r--r-- | railties/lib/tasks/testing.rake | 15 |
3 files changed, 28 insertions, 0 deletions
diff --git a/railties/helpers/performance_test.rb b/railties/helpers/performance_test.rb new file mode 100644 index 0000000000..d39f639305 --- /dev/null +++ b/railties/helpers/performance_test.rb @@ -0,0 +1,11 @@ +ENV['RAILS_ENV'] ||= 'test' +require "#{File.dirname(__FILE__)}/../../config/environment" +require 'test/unit' +require 'action_controller/performance_test' + +# Profiling results for each test method are written to tmp/performance. +class BrowsingTest < ActionController::PerformanceTest + def test_homepage + get '/' + end +end diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb index 2f2dd82682..d31ab5bb49 100644 --- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb +++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb @@ -51,6 +51,7 @@ class AppGenerator < Rails::Generator::Base m.template "helpers/application.rb", "app/controllers/application.rb", :assigns => { :app_name => @app_name, :app_secret => md5.hexdigest } m.template "helpers/application_helper.rb", "app/helpers/application_helper.rb" m.template "helpers/test_helper.rb", "test/test_helper.rb" + m.template "helpers/performance_test.rb", "test/performance/browsing_test.rb" # database.yml and routes.rb m.template "configs/databases/#{options[:db]}.yml", "config/database.yml", :assigns => { @@ -155,6 +156,7 @@ class AppGenerator < Rails::Generator::Base test/fixtures test/functional test/integration + test/performance test/unit vendor vendor/plugins diff --git a/railties/lib/tasks/testing.rake b/railties/lib/tasks/testing.rake index cc2376cbb3..2cadcd55fa 100644 --- a/railties/lib/tasks/testing.rake +++ b/railties/lib/tasks/testing.rake @@ -103,6 +103,21 @@ namespace :test do end Rake::Task['test:integration'].comment = "Run the integration tests in test/integration" + Rake::TestTask.new(:benchmark) do |t| + t.libs << 'test' + t.pattern = 'test/performance/**/*_test.rb' + t.verbose = true + t.options = '-- --benchmark' + end + Rake::Task['test:benchmark'].comment = 'Benchmark the performance tests' + + Rake::TestTask.new(:profile) do |t| + t.libs << 'test' + t.pattern = 'test/performance/**/*_test.rb' + t.verbose = true + end + Rake::Task['test:profile'].comment = 'Profile the performance tests' + Rake::TestTask.new(:plugins => :environment) do |t| t.libs << "test" |