LoadWise

Load Testing reuses functional test scripts

Version 0.6

Windows XP+

Script Reuse - Easy to Maintain Load Test

Maintainability, generally is not under radar of load testers. Most of commercial load testing tools heavily rely on its recording functions. As we know, with number of load test scripts increases, maintenance effort grows exponentially. Recording is not good answer.

RWebSpec load test scripts are not only readable and flexible, but also easy to maintain through script reuse.

Example

We use the test script in previous chapter.

load File.join(File.dirname(__FILE__), "spec_helper.rb") # Reuse Helper Functions
include SpecHelper

run_with_virtual_users(5) {

  browser  = open_browser("travel.agileway.net", :proxy => "proxy_server:3129")
  home_page = HomePage.new(browser) # reuse Page Class
  home_page.enter_user_name("agileway")
  home_page.enter_password("test")
  log_time("Sign In") { home_page.click_sign_in } # Log page response time

  browser.click_radio_option("tripType", "return")
  browser.select_option("fromPort", "New York")
  browser.select_option("toPort", "Sydney")
  log_time("Select Flight") { browser.click_button_with_caption("Continue") }

  fail_safe { browser.click_link("SIGN-OFF") }
}

As we see, you can use functions defined in spec_helper.rb and all Page Classes defined. For instance, if programmer made a change to home page (change field 'username' to 'login'). If test scripts created as above, no matter how many test scripts you have, you only need to update one place: home_page.rb.