I. jmeter association method:
In jmeter, you can right-click the request to obtain data --> the post-processor selects the desired association method. If there are many ways to extract dynamic data:
Ii. Regular Expression Extraction Tool:
1. For example, if you need to extract "<title> Baidu" from the following response text, you will know "Baidu" in </title> ":
2. Set the regular expression extractor:
Note:
(1) Reference name: name of the parameter to be referenced in the next request. If you enter the title, you can reference it with $ {Title.
(2) regular expression:
(): The included parts are extracted.
.: Match any string. +: One or more times. ? : Don't be greedy. Stop after finding the first match.
(3) template: referenced with $. If there are multiple regular expressions in the regular expression, it can be $2 $3 $, etc, indicates the number of parsed values to the title. For example, $1 $ indicates the parsed 1st values.
(4) matching number: 0 indicates a random value. 1 indicates all values. Normally, enter 0.
(5) Default Value: If the parameter has not obtained a value, it is given a value by default.
3. Use the value obtained in 2:
Iii. Examples of Regular Expressions:
1. Extract A single string:
If you want to match the following parts of the web page: Name = "file" value = "readme.txt"> and extract readme.txt. A suitable regular expression: Name = "file" value = "(. + ?) ">.
(): Encapsulates the matching string to be returned.
.: Match any single string.
+: One or more times.
? : Don't be greedy. Stop after finding the first match.
2. Extract multiple strings:
If you want to match the following parts of the web page: Name = "file. Name" value = "readme.txt"> and extract file.nameand readme.txt. A suitable regular expression: Name = "(. + ?) "Value =" (. + ?) ". In this way, two groups are created for $1 $ and $2 $ respectively.
For example:
Reference name: myref
Template: $1 $2 $
The values of the following variables will be set:
Myref: file.namereadme.txt
Myref_g0: Name = "file. Name" value = "readme.txt"
Myref_g1: file. Name
Myref_g2: readme.txt
You can use $ {myref} and ${myref_g1 for reference.
Jmeter Association. The regular expression extractor uses 1