Posts Tagged ‘LoadRunner’

Quick Tip – Fixing A Locked LoadRunner Results Directory

Posted on March 9th 2011 by Joel Deutscher

Everynow and then, Vugen will have a little episode and decide that its default results directory is locked, and you will be presented with an friendly dialog box like the one below.

The result directory is locked

If you have ever wondered what is going on, it turns out the culprit is mmdrv.exe. This executable is the Multithreaded Driver Command Line application that is used to simulate virtual users, and killing all instances from the task manager will remove any locks on your results directory, and you can go back to normal vugenning.

While most of us don’t mind using multiple directories, it seems that even in Vugen 11, the replay log window will always show the log of the first results directory after playback. This can be very confusing when debugging scripts.

This exe can also be used manually to execute vuser scripts from the command line. This can be handy for environment smoke tests. I will write more about some alternate uses for mmdrv.exe in a later post.

Quick Tip – Blank Parameters in LoadRunner

Posted on March 1st 2011 by Joel Deutscher

LoadRunner happily accepts blank parameters, it just that Vugens parameters screen doesn’t realise it yet. Web searches show this being a problem for people as far back as 2008 and there are all kinds of solutions posted.

The blank parameter in notepad

Even though our blank parameter does not show up in Vugen parameter window, it is recognised.

And heres your blank parameter.

Nothing new here, though for me, it was more of a problem than a solution. I was caught out with two blank lines at the end of a parameter file. When editing in notepad, be sure to only have one blank line at the end of your parameter files. The single blank newline must be there, as its used as an end of file delimeter, and is not used as a parameter.

Dynamic Parameter Names in LoadRunner

Posted on January 4th 2011 by Joel Deutscher

Occasionally, you might want to perform the same action multiple times with different parameters. While you should be very carefull with this type of scripting, the following is a basic example of how to do this in LoadRunner.

The following script will perform three searches on google.com.au using three different parameters.

Action()
{
	int i;
	char temp[10];

	// Progress Through 3 Client IDs stored in {Param_1}, {Param_2} and {Param_3}
	for(i=1;i<4;i++) {
		sprintf(temp,"{Param_%d}",i );
		lr_save_string(lr_eval_string(temp), "Param_Value");
		lr_start_transaction("Search");

		// Extract Variables
		web_reg_save_param("Number_of_Results", "LB=About ", "RB= results", LAST);

		// Validate Content
		web_reg_find("Text=", LAST);

		web_url("search", 
			"URL=http://www.google.com.au/#hl=en&q={Param_Value}", 
			"Resource=0", 
			"RecContentType=text/html", 
			"Referer=", 
			"Snapshot=t1.inf", 
			"Mode=HTML", 
			LAST);
 
		lr_end_transaction("Search", LR_AUTO);
	}
	return 0;
}

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);

web_submit_data("web_submit_data",
	"Action=http://www.headwired.com/login.php",
	"Method=POST",
	"TargetFrame=",
	"Referer=https://www.headwired.com/login.php",
	"Snapshot=t3.inf",
	ITEMDATA,
	"Name=username", "Value={INPUT_USERNAME}", ENDITEM,
	"Name=password", "Value={INPUT_PASSWORD}", ENDITEM,
	LAST);

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.

Fix Slow VuGen Replay?

Posted on October 8th 2010 by Joel Deutscher

StopwatchQuick tip: If you find VuGen is running slowly, it’s probably because you have the parameters data file open.

How much slower you ask? On a longer script I saw run-time drop from 415.8620 seconds to 50.2816 seconds

The good news is, closing the parameters file provides an instant boost of speed.