jmeter implement the login and set the token as a global variable

A long time without jmeter found previous usage basis are forgotten, so re-record it.

We usually use the software are required to log in before they can carry out other operations, such as blog park, to send blog login first.

1. Add the http request default values ​​in the following test program, we can add a good domain name, just enter the URL to each request, we have Baidu, for example.

 

 

2. login request

 

3. Add the regular expression extractor get token

(1) the reference name token

(2) the regular expression "token": "(+.?)"

(3) $$ template reference with them, if there are multiple regular expressions in regular expressions, you can be $ 2 $$ 3 $, etc., it represents the first of several to resolve value to the title. Such as: $ 1 $ 1 represents the analytical value to the first

(4) represents a random value matches the number 0, 1 represent all values, usually filled 0

(5) If the default value to the parameter value is not achieved, then a default value to take it

 

4. The token value to a global variable, $ {__ setProperty (newtoken, $ {token},)}

 

 5. Add Request header used as a global manager, the token uses the following variables. $ {__ property (newtoken)}

 

6. The above can be used to complete the other operations after the completion logged jmeter

 

Guess you like

Origin www.cnblogs.com/zynzyf/p/11221958.html