LoadRunner Scripting Auto-correlation and manual correlation

Source: Internet
Author: User
Tags list of attributes

About LoadRunner Associations
First, when to associate
1. Meaning of the Association
Association (correlation): InDuring the script playback process,The client makes a request through the left and right boundary values (that is, association rules) defined by the correlation function,The server responds by looking in the content, gets the corresponding value, replaces the variable in the formThe static value at the time of recording, which makes the correct request to the server, whichThe method of dynamically acquiring server response content is called Association.
In fact, the association also belongs to a special parameterization, but with the general parameterization is somewhat different
General parametric parameters are derived from a file, a defined table, a result set written through SQL, etc., but the parameters obtained by the Association are a qualified, dynamic value returned by the server response request.
2. When to make a connection
To understand this problem, we first need to know the client and server-side request and response process
Process Description:
Client sends a request to get the login page
After the server side obtains the request, returns the login page, and dynamically generates a session ID
WhenUser inputUser namePassword, the session ID is sent to the server side when the login is requested.
If the session ID is valid in the current session, the login successful page is returned and the login fails if it is not correct
During the first recording, LoadRunner this valueRecorded down, written in the script, but again when the client makes the same request, and the server side again dynamically generated session ID, the client made a request is wrong, in order to get this dynamic session ID we use the association here.
So we come to the conclusion that
When a client's request is dynamically changing with the server side, we need to use the associated
Of course, when we're recording the script, we shouldof the testProject to get a proper understanding of which requests need to use the dynamic value of the server response, if we are not sure that those values need to be correlated, we can also record the script two times, by comparing the script to find the part that needs to be associated, but not that all the different points of two recordings need to be correlated, This is going to be a concrete case.

Second, automatic correlation LoadRunner parameterization
Auto-correlation consists of two mechanisms:
One is the LoadRunner by comparing the recording and playback when the server response is different, and prompts the user whether to associate, the user can create their own association rules, this function can easily make us need to relate to the part, but also there are some problems, For example, the correlation point detected by auto-correlation does not necessarily need to be correlated, so we can judge it more realistically; some need to correlate the Dynamic Data Auto Association cannot be found, this is the need to do a manual association
The other is the automatic association rule that comes with LoadRunner, which automatically creates associations based on these rules when recording scripts
The steps to automatically associate are as follows:
1. Turn on auto-correlation option
The two related mechanisms mentioned earlier, if users want to create associations using LoadRunner's own association rules, then they need to enable association rules in recording Options > Internet Protocol > Correlation , select Enable correlation during recording, and when you record scripts for these application systems, Vugen automatically establishes the association in the script. You can also add Association rules in recording Options > Internet Protocol > Correlation to achieve Automatic association.
If you need to LoadRunner Auto-detect the part that needs to be associated when you play back the script, you need to select Save Correlation in Tools > General Options > Correlation Information during replay "and" show scan for correlations popup after replay of VUser ", when playback plays the script, the scan will pop upAction for correlation window, searching for associated points
2. Recording Scripts
The process of recording a script doesn't say much here.
3. Playback scripts
If the recorded script has parts that need to be associated, an error occurs when the script is played back
4. The system automatically pops up the detection Associationdialog box, or manually Start the Association Detection dialog box
If you select Save Correlation information during replay and show scan for in Tools > General Options > Correlation Correlations popup after replay of VUser ", then the" Scan Action for Correlation "window will automatically pop up after the script is played back, click" Yes "to find it automatically
If you do not select the above settings, you can also press CTRL+F8 to start the association auto Search
5. Viewing the associated points detected by the System for association settings
If there is a discrepancy in recording and playback, LoadRunner will list what needs to be done in the "Correlation Results", click on the "Create rule" with the mouse, click on the button, and the system will show the rules for getting the current data, click "Yes" "To complete the creation of the rule while viewing the script with the addition of a web_reg_save_param function
You can also click the "Correlate" button to create an association, a pen or a stroke, or press "correlate all" to get Vugen to associate all data at once.
Note: Since correlation studio will find all the changed data, not all of the data needs to be associated, so it is not recommended that you use "correlate all" directly.
6. Playback script Check the correctness of the association
When the association is created, the playback script checks the correctness of the association

Third, Manual Association
The process of manual association is as follows:
First step: Record test script, record two times
Step Two: Use WinDiffTool to find out the differences between two scripts to determine if you need to correlate
Step three: Determine where to insert the association
Fourth step: Manually establish the association using the Web_reg_save_param function in the view tree
Fifth step: The script is useful to the associated data, with parameters instead of
Sixth step: Verify the correctness of the association
Here is a detailed description:
First step: Record test script, record two times
This step does not have to say more, the same operation, recording two copies, respectively saved
Step two: Use the WinDiff tool to help identify the data that needs to be correlated
1. In the second script, click on "Tools" > "Compare with VUser ..." In Vugen and select the first script.
2. Then WinDiff will open, displaying two scripts and showing the difference. WinDiff will mark a different script with a whole line of yellow, and display the true difference in a red font. (If you don't see the Red font, click Options > View > Show Inline Differences).
See the differences in the two scripts, each of which may be the place to relate.
Note: The differences in the Lr_thik_time section can be ignored
After you find the different sections, copy and then open recording log or generation log, press ctrl+f, paste the contents of the diff section in the Find window, click Find to see theInformation, whether the client requests information or the server responds
If it appears in the $$$$$$ request Header for Transaction with Id 3 Ended $$$$$$ This section, that proves to be the client-issued requests, here is no need to do the correlation
The General association is present in ****** Response Header for Transaction with ID 7 ****** and ****** Response Body for Transaction with ID 7 ****** Part.
After you find this information, you need to record the following information:
A. Record the content before and after the different data
B, record the location of this different data, is the header or body
Step three: Confirm where to insert the association
We found the location of the different points of the script two times in the log, according to this location, we determine which request is generated after, that is, to locate the different points of the response is by which request generated, found the function location of the request, we know where to do the association.
In general, association functions are written before the requested function is made.
Fourth step: Insert the correlation function
Before inserting the correlation function, we first introduce the correlation function Web_reg_save_param
An example of a Web_reg_save_param function:
Web_reg_save_param ("SessionID",
"LB=SESSION_ID:",
"Rb=;",
"Search=body",
last);
Here we only describe the meaning of a few common parameters
Syntax: int web_reg_save_param (const char *paramname, <list of Attributes>, last);
Parameter description:
ParamName: The parameter name of the dynamic content to be stored
List of Attributes: Other properties, including: Notfound, LB, RB, Relframeid, Search, ORD, Saveoffset, Convert, Savelen. Property values are not case-sensitive
LB (left boundary): Returns the leftmost string of information. The property must be, and is case sensitive.
RB (right): Returns the boundary of the message. The property must be, and is case sensitive.
Search: Returns the search scope for the information. Can be Headers,body,noresource,all (default). The nature of the genus is optional.
SoHow do I insert this correlation function?
1. Switch the Vugun to view tree mode
2. In the list on the left, locate the function that made the request in the previous step, and click "Right button"
Select "Insert Before"
3. In the "Add Step" dialog box, enter "Web_reg_save_param" in "Find function" and click "OK"
In "Parameter name", enter the name of the associated function, here best meaning, "SessionID"
Enter in "left boundary", a few characters from the left of the different points of the string just recorded, define the Ieft border, session_id:
in the "right Boundary "in the input, just record the different points of the string to the right of a few characters, the definition of the left edge;
in the "Search in", select "Body"
Click "OK"
4. Go back to script editing mode and see if the function is inserted correctly
before issuing the requested function:
Web_reg_save_param ("Sessio  Nid ",
" lb=session_id: ",
" rb=; ",
" Search=body ",
last);
Fifth step: The script is useful to the associated data, with the parameters instead of
as the parameters of the request to make the following, then the original server returned dynamic value using {SessionID} to replace:
Web_submit_form ("login.php_2",
" Snapshot=t2.inf ",
ItemData,
" Name=login "," Value=wangjin ", Enditem,
" Name=password "," Value=wangjin ", Enditem,
"name=session_id", "value={SessionID}", Enditem,
"Name=submit", "Value=login", Enditem,
Extrares ,
"Url=/media/images/border_bg_l.gif", Enditem,
"Url=/media/images/header_bg.gif", Enditem,
"URL=/media /images/th.gif ", Enditem,
last);
Sixth step: Verify the correctness of the association
Playback script to verify the correctness of the association.

Reprint: http://blog.163.com/yang_jianli/blog/static/161990006201431113845401/

LoadRunner Scripting Auto-correlation and manual correlation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.