LR 的关联

1. Correlation Overview

     Correlation is used when a recorded script includes a dynamic value(such as a session ID) and cannot replay. To resolve this, you make the dynamic value into a variable thereby enabling your script to replay successfully.

     For example, many applications and web sites identy a session by the current date and time. If your try to replay a script, it will fail because the current time is different than the recorded time. Correlating the data enables you to save the dynamic data and use it throughout the scenario run.

     When a correlation is created, VuGen adds a function that extracts the dynamic value to a parameter. Appropriate occurrences of the original value are replaced with a parameter.

2. Correlation Vs. Parameterization

    Parameterization is used when you want to take a value and turn it inton a variable in order to make your script more realistic. For example, if your are filling out a form on a website, your may want to vary the value entered for a particular filed.

    Correlation is used when a recording script included a dynamic value and cannot replay. To resolve this,

your make the dynamic value into a variable thereby enabling your script to replay successfully.

3. Determining which values to correlate

    Once you generate a list of differences, you need to determine which ones to correlate. If you mistakenly correlate a difference that did not require correlation, your replay may be adversely affected.

The following strings most probably require correlation:

- Login string. A login string with dynamic data such as a session ID or a timestamp.

- Date/Time Stamp. Any string using a date or time stamp, or other user credentials.

- Common Prefix. A common prefix, such as SessionID or CurrentID, followed by a string of characters.

4. How to correlate Scripts - Web(HTTP/HTML)

    This task describes the different ways to correlate web(HTTP/HTML) protocol scripts.

 - Scan for correlations

    a. Select Vuser > Scan for correlations. This scans the entire script for mismatches between recording and replay snapshot data in web steps. The search occurs in all server reponses.

    b. If mismatches are found they will be dispayed in the Correlation Results tab of output window.

    c. When a mismatch is correlated, VuGen adds a Web_reg_save_param_* function and saves the original value in a comment in the script. Appropriate occurrences of the original value in web steps are replaced with a parameter.

- Manual Correlation

  If the scan for correlation did not resolve all correlation-based errors in your script, you can attempt to manually correlate your script as follows:

  a. Search for values that need correlation manually. There are a number of ways to manually search for values that need correlation. For details. see How to Search for values that Need Correlation.

  b. Correlate the value

  Select one of the following methods:

  Correlate from snapshots.  Highlight the value to correlate, right-click, and select Create Correlation.

  Manually add correlation functions. Manually insert the relevant correlation functions into your script. For details, see how to Mannually Correlate Web Scripts.

How to Search for values that Need Correlation

The following steps describe different ways to search for values that need correlation.

1. Search by Compring Scripts

2. Replay log search

a. Scan the script in script view for strings that may need correlation such as hash string, random strings, session ID's,etc.

b. Search the generation log for the first time that the string appears(this is the response from the server)

c. Search the extended replay log for the same response. Check to seen if this response contains a different string within the same boundaries as the original suspected string. If yes, this string requires correlation.

How to Manually Correlate Web Scripts

1. Locate the string and its details

    Identify the statement that contains dynamic data and the patterns that characterize the locations of the data. These patterns may be boundaries or xpaths.

    a. Identify Patterns using Boundaries

        Use these guidelines to determin and set the boundaries of the dynamic data:

        - Analyze the location of the dynamic data within the HTTP response

        - Identify the string that is immediately to the left of the dynamic data. This string defines the left boundary of dynamic data.

       - Identify the string that is immediately to the right of the dynamic data. This string defines the right boundary of the dynamic data.

       - The right and left boundaries should be as unique as possible to better locate the strings.

    b. Identify Patterns using Xpaths

        Use the snapshot pane to manually search for the xpath of the desired string.

     

2. Add web_reg_save_param_* function

    Add a Web_reg_save_param_ex or web_reg_save_param_xpath function into the script befor the statement that contains the dynamic data.

3. Replace data with parameter

猜你喜欢

转载自lingxiayidu-wjx.iteye.com/blog/2364668
LR