You are on page 1of 17

Understanding Correlation In HP LoadRunner

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

Correlation

What is correlation Types of Correlation Automatic Correlation Manual Correlation

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

What is Correlation

Sometime, after creating a script, a simple playback fail even though the recording of the same actions succeeded. Many applications use dynamic values that change each time you use the application. For example, some servers assign a unique session ID for every new session. When you try to replay a recorded session, the application creates a new session ID that differs from the recorded session ID. LoadRunner addresses this issue through correlation. Correlation saves the changing values to a parameter.

When running the emulation, the Vuser does not use the recorded valueinstead, it uses the new value assigned to it by the server.

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

Automatic Correlation

Open HP Web Tours. Select Start > Programs > LoadRunner > Samples > Web > HP Web Tours Application. A browser opens with the HP Web Tours home page. Click the administration link on the HP Web Tours home page. The administration page opens. Select the 3rd checkbox entitled: Set LOGIN form's action tag to an error page. Scroll down to the bottom of the page and click Update. Scroll down to the bottom of the page and click the Return to the Web Tours Homepage link. This setting tells the server not to allow duplicate session IDs. Close the browser.

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

Automatic Correlation

In the modified configuration of HP Web Tours, the server assigns a unique session ID to the Vuser. If you try to play back the script, it will fail. To overcome this issue, you use VuGen to automatically detect the need to correlate the session ID. After you run the script, VuGen prompts you to scan the script for correlations.

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

Automatic Correlation

You will instruct VuGen to insert a step that saves the original session ID to a parameter. In each replay session, VuGen saves the new unique session ID to a parameter. In the subsequent steps, it uses the saved value instead of the originally recorded value. Record a new script with the same steps that you recorded previously and save the script as Basic_Tutorial_Cor. Click Verify Replay in the Task Pane and click the Start Replay button at the bottom of the instruction pane. VuGen runs the new script. You may notice several error messages in the Replay Log tab in the Output window, indicated by the red-colored text. Click Verify Replay in the Task Pane to view the Last Replay Summary.

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

Automatic Correlation

Click the link Show and resolve dynamic server values in the instruction pane under the heading Dynamic Server Values. VuGen scans the script, searching for differences between the recorded values and the playback values. VuGen displays a list of these differences that may require correlation in the Correlation Results tab in the Output window. Select the first entry in the Correlation Results tab, and click Correlate.

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

Automatic Correlation

VuGen inserts a new step at the top of the script saving the original session ID to a parameter. In each replay session, VuGen saves the new unique session ID to a parameter. In the subsequent steps, it uses the saved value instead of the originally recorded value.

Select View > Tree View to view this new step in the test tree.

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

Automatic Correlation

View > Script View to view the correlation statement in the script. This statement means Check the server response for data located between the following two strings: Left boundary: userSession value= Right boundary: >

The statement instructs VuGen to save the first occurrence of this data to a parameter called WCSParam_Diff1.

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

Automatic Correlation

Select Vuser > Run to replay the script again. When the replay ends, select View > Tree View.

Look in the Replay Log tab. Note that VuGen no longer issues the red-colored error messages.

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

Automatic Correlation

In the script, right-click Service: Reg Save Param and select Go to step in Replay Log. VuGen places the cursor at the corresponding line in the replay log.
The log indicates that function web_reg_save_param succeeded, indicating that the correlation worked.

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

Manual Correlation

Record a new script with the same steps that you recorded previously and save the script as Manual_Cor_1. Record another script using the same steps as above and save the script as Manual_Cor_2. Now for script Manual_Cor_2, click on Tools > Compare with script option and select Manual_Cor_1 script to compare with. Notice that a WDiff window is displayed, showing both the scripts and the differences in recording are highlighted in yellow color.

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

Manual Correlation

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

Manual Correlation

Notice that there is a difference in the userSession value in both the scripts. Navigate to Script view and add the following line to the code: web_reg_save_param("myval", "LB=userSession value=", "RB=>", LAST ); Now search for the userSession value and replace the hard-coded valye by parameter as: {myval} Replay the script and notice that it plays back successfully.

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

Manual Correlation

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

Questions - To Review Your Skills


What is correlation and why is it done? Perform Automatic correlation on the script. Perform Manual correlation on the script.

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

Thank You

>>>>>>>>>>>>>>>>>>>>>> www.softwaretestinggenius.com <<<<<<<<<<<<<<<<<<<<<<

You might also like