Tuesday, 26 March 2013

How do I work with unique server values | Loadrunner Tutorial pdf

How do I work with unique server values?

In the modified configuration of HP 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.
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.
1. Record a new script with dynamic values.
Record a new script with the same steps that you recorded previously and save the script as Basic_Tutorial_Cor.
2. Replay the script.
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.
3. View the Replay Summary
Click Verify Replay in the Task Pane to view the Last Replay Summary.

The summary shows that your script failed.
4. Scan the script for correlations.
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.

5. Correlate the Session ID.
Select the first entry in the Correlation Results tab, and click Correlate.
VuGen inserts a new step at the top of the script, 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. Choose View > Tree View to view this new step in the test tree.

6. Examine the syntax of the correlation statement.
Choose View > Script View to view the correlation statement in the script.
The statement that VuGen added to the script looks like this:
web_reg_save_param (“WCSParam_Diff1”,
“LB=userSession value=”,
“RB=>”,
“Ord=1”,
“RelFrameId=1.2.1”,
“Search=Body”,
LAST);
This statement means “Check the server response for data located between the following two strings” Left boundary userSession value= and right boundary >. Save the first occurrence of this data to a parameter called WCSParam_Diff1.”
7. Play the script again.
Choose Vuser > Run to replay the script again. When the replay ends, choose View > Tree View. Look in the Replay Log tab. Note that VuGen no longer issues the red-colored error messages.
Right-click on the second step Service: Reg Save Param in the script and choose 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.
8. Fix the server configuration.
Reset the server to ignore unique session IDS.
Choose Start > Programs > LoadRunner > Samples > Web > HP Web Tours Application to open HP tours. Click the administration link on the HP Web
Tours opening page. In the administration page, clear 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. Close the browser.
Automatic Correlation In this lesson, you scanned a script for correlations after recording the user actions.
VuGen also provides a set of configurable correlation rules to handle dynamic values during the recording session. For details on automatic correlation, refer to the HP Virtual User Generator User’s Guide.
Most servers have clear syntax rules, or contexts, that they use when creating links and referrals. If you are recording a session with a supported application server, you can use VuGen’s built-in correlation rules, and
VuGen will detect and correlate the dynamic values during the recording stage.

No comments: