Quick Tip – Validating Authentication Test Data in LoadRunner

Posted on October 31st 2010 by Joel Deutscher

LoginHere is a familiar situation. Thousands of potential accounts for use in performance testing, some of which work, some don’t. In this example, it’s the login credentials. This usually requires you to run through your test data one by one to see which accounts work, and which don’t, removing the accounts that error. By turning off HTTP redirects, you can speed up this process significantly.

This example script is a minimalist way of checking the data in a fairly quick way, without the burden of actually loading the pages. All you need to know is the URL that you are redirected to on successful login (or failure). In this example, the user is redirected to /dashboard.php on successful login.

// Disable HTTP Redirects to time Authentication
web_set_option("MaxRedirectionDepth", "0", LAST);

// Find Authenticated URL
web_reg_save_param("redirect_url", "LB=Location: ", "RB=\r\n", "Search=Headers", LAST);

	"Name=username", "Value={INPUT_USERNAME}", ENDITEM,
	"Name=password", "Value={INPUT_PASSWORD}", ENDITEM,

if(!strcmp(lr_eval_string("{redirect_url}"),"https://www.headwired.com/dashboard.php")) {
	// Login Successful
	lr_output_message(lr_eval_string("Login Successful - {INPUT_USERNAME},{INPUT_PASSWORD}"));

Some of you may want to write the valid and invalid accounts to a file, yet for a once off execution, this method suits me just fine.

About the Author

Joel Deutscher is an experienced performance test consultant, passionate about continuous improvement. Joel works with Planit's Technical Testing Services as a Principal Consultant in Sydney, Australia. You can read more about Joel on LinkedIn.

Comments are closed.