LoadRunner performance testing system learning tutorial: scripting related technology (6)

Last issue talked about the parameterization technology of LoadRunner performance test script writing. In this issue, we will learn the related technology of script writing together.

Link after recording

When neither the built-in association rules nor the newly created rules meet the needs before recording, or when you don't know where to associate, you can only associate after recording.

The post-recording association is somewhat different from the built-in association. After the recording, the association is established after the script is executed. That is to say, after the script is recorded, the script must be executed at least once before the association will have an effect after recording. After recording, it will try to find the difference between the server response during recording and execution, find the data that needs to be associated, and establish the association.

When an error is reported during script playback, click the menu Vuser→Scan Script for Correlations or press the shortcut key Ctrl+F8, as shown in the figure.

LoadRunner performance testing system learning tutorial: scripting related technology (6)LoadRunner performance testing system learning tutorial: scripting related technology (6)

Pop-up related information results
LoadRunner performance testing system learning tutorial: scripting related technology (6)

Check the results of the scan, select the data that needs to be associated, and click the Correlate button to create an association. At this time, there will be a green tick in front of the associated data, as shown in the figure.
LoadRunner performance testing system learning tutorial: scripting related technology (6)

Then click the Create Rule button to create a rule for the association, and the WebStudioViews dialog box will pop up, prompting the left and right boundary information of the rule. Click the "Yes" button, as shown in the figure.

LoadRunner performance testing system learning tutorial: scripting related technology (6)
So the association has been created

You can see the rule just created in Tools→Recording Options→HTTP Properties→Correlation, as shown in the figure.
LoadRunner performance testing system learning tutorial: scripting related technology (6)

The left and right borders of the rules in the figure are consistent with the left and right borders of the prompt message popped up in the figure.

Manual link

The pre-recording and post-recording associations belong to the category of automatic association. Under normal circumstances, automatic association can solve most of the association problems in script recording, but if there is a situation that cannot be solved by the above two methods, you can only use manual The associated method is associated. The principle of manual association and automatic association is the same. For manual association, you need to find the amount that needs to be associated first, and then use the association function provided by LoadRunner to perform the association.

The general steps for manual association are as follows:

1. Record two scripts to ensure that the business process and the data used are the same.

Simply put, the same recording action is used in the recording process to record two scripts.

2. Use the WinDiff tool to compare the two scripts and find the data that needs to be associated.

WinDiff is the file comparison tool that LoadRunner comes with. It is used to compare the contents of two files, find out the differences between the two, judge the differences in the two scripts, and then find the data that needs to be associated. The reason why the comparison is needed here is because the data that needs to be associated is the data returned from the server. If it is found in the comparison that for the same parameter, the value returned by the server is inconsistent, then the data is dynamic and needs to be associated.

Select the Compare with Vuser option under the Tool menu, as shown in the figure.
LoadRunner performance testing system learning tutorial: scripting related technology (6)

In the pop-up dialog box, select the script to be compared with the current script, as shown in the figure.
LoadRunner performance testing system learning tutorial: scripting related technology (6)

Then WinDiff starts, and the two scripts are displayed at the same time, and the differences are displayed. WinDiff will mark the different scripts with a whole line of yellow, as shown in the figure.

LoadRunner performance testing system learning tutorial: scripting related technology (6)
Then check the differences between the two scripts, each of the differences may need to be associated. Note: The difference of lr_think_time does not need to be analyzed, because lr_think_time is used to simulate the delay time of the user's thinking between each step.

3. Find the left and right border strings. Before inserting the correlation function, you must first find the left and right boundary strings, choose to copy the different characters in the WinDiff comparison, and find the corresponding position in the Generation Log, as shown in the figure.
LoadRunner performance testing system learning tutorial: scripting related technology (6)

The figure clearly shows the left and right borders of the associated data. The left border is "userSession value=" and the right border is ">". Of course, the longer the left and right borders, the better. In this way, the correlation function can be written as follows.

web_reg_save_param("CSRule_1_UID2", "LB=userSession value=", "RB=>", "Ord=1", "RelFrameId=1", "Search=Body", LAST);

4. Use the web_reg_save_param function to manually establish the association. After finding the left and right boundaries of the rule, you need to insert the web_reg_save_param function to manually establish the association. First, find the position where the association function is inserted, and click Vuser→Run-Time Settings→General→Log→Extended log to select all the following options. Find the different strings in WinDiff in the Replay Log. As shown in the figure, the position of the associated function is inserted in front of this code.
LoadRunner performance testing system learning tutorial: scripting related technology (6)

5. Replace the associated data in the script with parameters. After using web_reg_save_param to establish the parameters, the next step is to replace the foot with the CSRule_1_UID2 parameter

The result of the final parameters is shown in the figure.
LoadRunner performance testing system learning tutorial: scripting related technology (6)

Guess you like

Origin blog.51cto.com/14645850/2540608