Thursday, November 14, 2013

How to create a correlation rule in Loadrunner


Suppose you are working in a web application and it has 10 business scenarios to be scripted as part of your performance testing. There is a correlation for session id which will be used in all the scenarios. 

In this case, we do not need to spend time to correlate the session id in each scenario. Instead, we can create the correlation rule and the rest will be taking care by VuGen while recording.

Lets see how are we going to create the correlation rule in VuGen. Consider that we are working in Mercury Web Tours application.

Pre-requisite:  You know the left and right boundary for the session ID.

Step 1: Open the recording option -> Correlation -> Check "Enable correlation during recording"

Step 2: Click on New Application and enter the name of the application. In our case, its "Mercury"



Step 3: Select Mercury in the left panel and Click on New Rule. Then enter the rule name "Session ID". In the right hand side, you need to update the left and right boundary value.
Also provide the correlation variable name. In our case, its "Param_SessionID".


Step 4: Click on Advance button. Check "Replace with parameter only for exact parameter". Then click on OK.


Step 5: Start recording the business flow. Once the recording is done, check the script. 
VuGen automatically done the correlation for Session ID and replaces all the occurrences.




It's over. Simple, Isn't it?

In Summary, You can create "N" number of rules under the application. So that VuGen will automatically correlated based on your rules placed under the application.




Tuesday, November 12, 2013

Loadrunner Script Anatomy


When you record and save a LoadRunner script in VuGen, there are a number of files that are created. This post explains what they are and what they do.

For example, You have script named "01_TicketReservation" with one action,  then the required files you would need in the 01_TicketReservation script directory would be:

Files Created While Recording




Here's what is in each file:
01_TicketReservation.usr : Primarily, the .usr file defines which actions are used by the script. There are other properties which define which protocols are used and other settings.

default.usp: Contains the run logic for the script.

default.cfg: Contains the run-time settings (except for run-logic).

globals.h: The global headers file- visible and editable in Vugen.

*.c (Action files): These are the action files containing your script code. You can edit these files in any text editor, if you want. 

01_TicketReservation.prm: Contains the parameter definitions.

*.dat: Your data files, you can save these in the script directory or somewhere else, even a mapped network drive on a different server.

Files Created After Playback



result1: One or more result directories are created which contain script playback results.

*.idx: The .idx files are binary "index" files created by Vugen for holding parameter values.

01_TicketReservation.ci: It is a final Compiled Image of the LR script.

combined_01_TicketReservation.c:  A list of #includes for all of your Actions.

logfile.log, mdrv.log: random log files which you will probably never need to look at.

mdrv_cmd.txt, options.txt: These text files contain commands and arguments for the script compiler and driver (mdrv) and are created dynamically.

output.txt: This one is important. This file contains all of the log messages generated during script playback. The contents of this file appear in the "Output Window" section of Vugen.

output.bak: A backup of the above file.

pre_cci.c: Output from the C pre-processor, which contains all of the functions used in your script, from all of the Actions and header files.

Files Required for Playback
During the course of recording and playback of scripts, the VuGen application will create many files, but only some of them are necessary for playback (either in VuGen or the Controller).

In summary, you can delete: *.txt, *.log, *.idx, *.bak, result*, pre_cci.c, combined_*, *.ci

There is a quick shortcut you can use, rather than going through and deleting everything manually. In VuGen, Go to 'File' menu, select 'Zip Operations' and 'Export to zip file'. In the dialog, select the 'Runtime files' radio button and 'Ok'. Now you have a "clean" script without the extraneous files created by Vugen.




Advantages

  • Making LR script folder a bit smaller in size which could be beneficial, if the script needs to be archived and stored for extended periods of time.
  • Maintaining big script repository and taking regular backup of the entire script repository could be very disk-space consumption particularly if all run time data files and execution results are also unnecessarily being backed up.

Monday, November 4, 2013

How to disable Data Execution Prevention (DEP) in Windows 7 and above


Problem:
Sometimes, VuGen will not record any events while recording the AUT. If you raise a HP ticket for this problem, HP team will ask you to check your DEP settings is disabled.
Now we see how to disable the DEP settings in Windows 7 and above machines.

Steps:
1. Login to Windows with a user account that has administrative privileges.
2. From a DOS command line run the command "> bcdedit.exe"
Confirm the default value for the "nx" parameter. If it is OptIn, then DEP is enabled.



3. Disable DEP by setting the "nx" parameter to "AlwaysOff" using the command "> bcdedit.exe /set nx AlwaysOff"


4. Rerun the command in step 2 above and verify that the "nx" parameter is set to "AlwaysOff".


5. Reboot the system to ensure that the "nx" parameter setting takes effect and DEP is disabled.

Sunday, November 3, 2013

The art of reusing the code snippets in loadrunner


Problem:
While working in Loadrunner, you may across the situation where some codes/functions are repeated in most of the scripts. In that case, you can create one function and reuse the function in all the scripts. It would help you to reduce your effort in terms of scripting and time. 

Solution:

This can be achieved by creating the header file. Now we will see how to create the header file and reuse the code in loadrunner.

Steps:
1. Open the notepad and write the below function.

#ifndef _MYCODES_H_
#define _MYCODES_H_

int multiplyNumbers(int arg1, int arg2, int arg3)
{
     return arg1 * arg2 * arg3;
}
#endif

PS: This is an example function to calculate the multiplication of three numbers.

2. Save this file as "MyCodes.h" in the following path
<Loadrunner Installation Directory>\include


Now you created a header file. You can use this header file in script by calling #include "MyCodes.h" as preprocessing directory in Global.h

How to call the function in loadrunner script

1. Include the header file in Global.h


2. Call the function available in header file in action


Hope this might help for you to reuse your codes and reduce the effort in time and cost.

Thursday, August 8, 2013

Removing .lnk virus from pen drive



Removing shortcut .lnk virus from Pen drive / External drive
Problem:

Sometimes after connecting your pen drive or external drive into computer, you can see the files with .lnk extension. It means your pen drive / external drive has been infected with the shortcut virus. You need to remove this virus permanently or else it will affect your computer.

Solution:

1. Close all the files / folders you opened in the machine.

2. Connect your pen drive / external drive.

3. Scan the pen drive / external drive with the antivirus if you have. (Mostly the virus will be removed in this step itself. However, sometimes it may not help. In that case, please follow the remaining steps)

4. Open the command prompt

5. Go to the pen drive / external drive folder.

6. Type the command attrib –s –h /s /d and hit enter

Now, you can see all the original files / folders without .lnk extension as well as with .lnk extension. You can just select the files / folders with .lnk extension and remove it from the pen drive or external drive.


Now your problem is solved.


Wednesday, July 10, 2013

An unsupported operation was attempted in Loadrunner

Problem:
 
While running the test in Loadrunner controller,"An unsupported operation was attempted" message occurred after clicking on error message and also output message box is empty.

Reason:

This error occurs due to the corruption of OLE (Object linking and embedding) file related to Input Output in LR installation.

Solution:

1. Close all the LR related components in the machine.

2. Register the service. Please run the below command

"regsvr32 C:\Program Files\HP\LoadRunner\bin\outputuiproj1.ocx"

 3. Rename the file "outputuiproj1.ocx" to "output~1.ocx"

4. Restart the machine. 

Now your problem is solved.



Linux Series - SED Utility/Package - 4. Deleting Lines

Let’s explore sed’s explicit delete command, which you specify by using the option 'd'. Again, we are using the sample file named &#...