Capture page response time and Script Reuse
Often we want to know page response time under load? In LoadWise, it is quite easy to do so.
Example
This following load test script will try to
- Sign in http://travel.agileway.net
- Select flight (arrival and departure city)
- Sign off
To capture page response time for 'Sign in' and 'Flight selection', we just need to add log_time around page submit operation.
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") }
}
Output like below:
VU[1] 15.879s VU[3] 15.91s VU[2] 15.926s VU[5] 16.333s VU[4] 17.974s [1] Sign In, 3.939 [1] Select Flight, 1.125 [1] Total Duration, 15.879 [2] Sign In, 3.72 [2] Select Flight, 1.281 [2] Total Duration, 15.926 [3] Sign In, 3.688 [3] Select Flight, 1.172 [3] Total Duration, 15.91 [4] Sign In, 6.689 [4] Select Flight, 0.219 [4] Total Duration, 17.974 [5] Sign In, 5.127 [5] Select Flight, 0.36 [5] Total Duration, 16.333