In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
one。 Introduction to the association:
The script recorded by LR only faithfully records all the data sent from the client to the server, and resends the recorded data in the recorded order when the script is played back. However, in fact, many systems use methods such as SessionID or SeqID to identify different tasks and datagrams, and applications do not send exactly the same data each time they run. Therefore, in order to enable the script to support the requirements of testing, it is necessary to use some mechanism to work out the data of the script. In a word: through association, you can maintain dynamic values in the test.
two。 General association steps:
1. Select the data that needs to be associated from the data returned by the server.
two。 Store this data in a parameter of the script
3. Replace the places in the script where you need to use this data with parameters.
Tip: for web, it is usually stored in a field of hidden. So look for the field value in the record that can be returned by the server.
Third, the purpose of the association:
1. Simplify or optimize code
For example, if you execute a series of related queries in turn, your code may become very long. To reduce the size of the code, you can nest queries, but this loses accuracy, and the code becomes complex and difficult to understand. With associated statements, queries can be linked without nesting.
two。 For dynamic data
Many applications and Web sites identify the current date and time of the session. If you try to replay the script, the operation will fail because the current time is different from the recording time (the WEB demo that comes with LR). By associating data, you can save dynamic data and use it throughout the scenario.
Four: associate operation
Method 1: automatic association
1.Tools-Recording Options.
two。 Record the login-exit process after the setup is complete.
3. Use the automatic association that comes with LR for association.
Method 2: associate manually
1: record the test script and record it twice
2: use the WinDiff tool to find out the difference between the two scripts and determine whether it needs to be associated (Compare with Vuser under Tools compares two scripts for the same operation)
3: determine where to insert the association
4: manually establish the association in VIEW TREE using the web_reg_save_param function
5: replace the associated data in the script with parameters
6: verify the correctness of the association
Five: positioning requires associated operation
1.Vuser-Scan Script. For Correlations
two。 Compare the values of 2 server changes in Server Response.
Six: common scenarios that need to be associated
1. Login operation.
two。 Check it first and then modify it, and then delete it.
3. Concurrency control: prevents two users from modifying or deleting a record at the same time.
Seven: correlation function model
Int web_reg_save_param (const char * ParamName, LAST); returned successfully: LR_PASS (0), failed LR_FAIL (1)
Example: web_reg_save_param ("Test", "LB=userSession Value", "LB= >", "Ord=1")
"RelFrameID=1.21", "Serch=Body", "IgoreRedirections=Yes", LAST)
Eight: associate summary manually
1. Manual association under normal circumstances: web_reg_save_param ("SessionId", "LB = value=\"," RB =\ ">", LAST)
LR: the left boundary of the desired intercepted string
RB: the right boundary of the desired intercepted string
If there are all kinds of special characters in the left and right boundaries, such as double quotation marks, you need to escape with\ first.
In general, if the left and right boundary of the truncated string is unique, it can be obtained directly in the above way without setting other attributes.
Yes. ("LAST" is fixed. )
2. If an error message is reported after the association, indicating that the parameterization is not successful, it may be due to the following reasons:
1) the value of the left and right boundary is incorrect. You can enter the Generation log to check whether the left and right boundaries of the associated parameters are correct.
2) the position of the correlation function is misplaced.
You can set log to output Extended log.
Set the method as follows: Vuser- > Run-time Settings- > Log property, select Extended log and select the following three logs.
Find the first output location of the parameter you want to associate in the output log (note that it is the value returned by response, not in request)
Compared with the number of lines in the script on the left, put the correlation function before the number of lines.
3. There is no problem with the correlation. No error is reported at run time, but the value of the parameter cannot be obtained. The reason can be found in Extended log.
Change the log in Replay Log to output Extended log- > Parameter substitution log, run it again, and you can see
The change of the associated parameters.
4. If a parameter correlation is successful, but the runtime finds that it will still report an error, you can consider whether it is because there are other values that you have intercepted.
This parameter is related, and with the change of that value, the parameter you intercept will change in some way, so you need to change the value of that change.
It is also parameterized. It is also possible that the associated parameters are returned many times by HTTP request, and the values referenced by each interface are different. Pay attention to customs clearance and packet analysis.
IX. Escape content commonly used in relevance
\ b Backspace key
\ f Page change
\ nWrap
\ r enter
\ t horizontal tabs
\ v Vertical tab character
\ 'single quotation mark
\ "double quotation mark
\\ backslash
\? Text question mark
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 216
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.