title: How to start with performance testing
body: <p>I am working on the rails 3.1.1 and using socery 0.7.11 for authentication, i need to implement the performance testing where i can test following things</p>
  
  <ul>
  <li>Simulate 100 users signing on and off simultaneously</li>
  <li>Simulate 100 users adding new interests simultaneously.</li>
  </ul>
  
  <p>I have go through the following links:</p>
  
  <p><a href="http://rubylearning.com/blog/2011/08/14/performance-testing-rails-applications-how-to/" rel="nofollow">http://rubylearning.com/blog/2011/08/14/performance-testing-rails-applications-how-to/</a> </p>
  
  <p><a href="http://guides.rubyonrails.org/performance_testing.html" rel="nofollow">http://guides.rubyonrails.org/performance_testing.html</a></p>
  
  <p>And able to do following things</p>
  
  <ul>
  <li>created test folder with test_helper.rb</li>
  <li>created test/performance/login_test.rb</li>
  <li>created fixtures/users.yml</li>
  </ul>
  
  <p>test_helper.rb</p>
  
  <pre><code>ENV["RAILS_ENV"] = "test"
  require File.expand_path('../../config/environment', __FILE__)
  require 'rails/test_help'
  
  class ActiveSupport::TestCase
    # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
    #
    # Note: You'll currently still have to declare fixtures explicitly in integration tests
    # -- they do not yet inherit this setting
    fixtures :all
  
    # Add more helper methods to be used by all tests here...
  end
  </code></pre>
  
  <p>/performance/login_test.rb</p>
  
  <pre><code>require 'test_helper'
  require 'rails/performance_test_help'
  
  class LoginTest &lt; ActionDispatch::PerformanceTest
  
    fixtures :users
    # Refer to the documentation for all available options
     self.profile_options = { :runs =&gt; 5, :metrics =&gt; [:wall_time, :memory],
                              :output =&gt; 'tmp/performance', :formats =&gt; [:flat] }
  
    def test_login
     post_via_redirect "http://bc.lvh.me/", :username =&gt; users(:youruser).username, :password =&gt; users(:youruser).password
  #using lvh.me coz login page is on my subdomain
    end
  end
  </code></pre>
  
  <p>fixtures/users.yml</p>
  
  <pre><code>one:
    username: eagleschasar12
    password: chaitanyA1#
  
  two:
    username: eaglesmarktell12
    password: chaitanyA1#
  </code></pre>
  
  <p>when i run rake test:profile, i got following result</p>
  
  <pre><code>E
  ===============================================================================
  Error: test_login(LoginTest)
  ActiveRecord::StatementInvalid: SQLite3::SQLException: table users has no column named password: INSERT INTO "users" ("username", "password", "created_at", "updated_at", "id") VALUES ('eagleschasar12', 'chaitanyA1#', '2012-06-15 06:43:01', '2012-06-15 06:43:01', 980190962)
  </code></pre>
  
  <p>So my questions are</p>
  
  <ul>
  <li>Why test command firing insert query?</li>
  <li>Do i need to write 100 records of users in fixture file to test the functionality?</li>
  <li>How to check session login/logoff?</li>
  <li>Also when i select interest types from db my user should logged in the system, so how can i test this scenario in performance testing?</li>
  <li>Does this tests run on webrick, which is my local server. </li>
  </ul>