Jmeter upper and lower parameter association

Explanation:
Why is there a context-related relationship between parameters? Because many times, one or several values ​​in the result returned by the previous interface will be used in the parameters of the next interface. If you make an association, you can directly reference the value.

1. First write an interface script, debug it, add a "view result tree", and execute the interface script, as shown in the figure; 2. Add Insert image description here
a "regular expression extractor" under the http request;
Insert image description here

3. Regular expression extractor configuration;
name: customized to facilitate your understanding of its meaning in the script;
reference name: the name filled in when the next interface is referenced;
regular expression: value range, accurate value;
template : $ 1 $, fixed format, no spaces in the middle;
Matching numbers: 1, fixed format;
Default value: Custom;
Insert image description here
4. How to write regular expressions?
First, find the value you want to use;
then, find the characters before and after the value;
finally, write the expression format: characters before the value + (. ?) + characters after the value.
Example:
Check the response data in "View Result Tree" and find the required value, as shown in the figure;
Insert image description here
write "data" in "Regular Expression": "(.
?)"} as shown in the figure:
Insert image description here
5. Next interface For reference, take the value anchor1_get_token filled in with the reference name in the regular extractor of the previous interface, and fill it in where the value needs to be used. The value is expanded with ${}, such as: ${anchor1_get_token}
Insert image description here

The above is the method of linking parameters up and down.

Guess you like

Origin blog.csdn.net/bigge_L/article/details/109512429