jmeter regular extraction tonken

 Regular extraction pit encountered token: token diagram of Figure 2 uses a regular expression extraction has been less than token, drawing a reason to return body is} the end, and Figure II is, in the end it leads to the Figure II token has been compared with less than (ah, I'm white, so will encounter such a problem ^ _ ^)

1, json return body "token": "(+.?)"} Can get to the wording of the token is returned, because the braces is over, but returned for the second json will not do, because it is not braces For details, see the end of 2

 

 

2 , "accessToken": "(.? +)",   The regular expression need to write in order to obtain

 

 

 

 

 

 

 

Get token : regular expressions to extract the text with: On the regular expression extraction can be explained with reference to: https: //www.cnblogs.com/rechin/p/9134069.html

1, set the http default values : Test Plan -> Add -> THreads (User) -> jc @ uitimate thread group -> Configuration Components -> http request defaults

http request to the default value (setting: default protocol, the server name or IP )

 

 

 

2, set the http header Management : Test Plan -> Add -> THreads (User) -> jc @ uitimate thread group -> Configuration Components -> http header Manager

http header Manager (addition request header type, adding regular acquisition token )

 

3, set only one controller: Test Plan -> Add -> THreads (User) -> jc @ uitimate thread group -> logic controllers -> only one controller

Only one controller ( regardless of the number of write cycles several times, put only one controller in the request to run only once, with most of the login, generally one login, there jdbc connection is also connected to it once without repeated connections )

 

3.1 Setting http request: Test Plan -> Add -> THreads (User) -> jc @ uitimate thread group -> logic controllers -> only one controller -> Right Add -> sampler-- > HTTP request

http requests (add paths, parameters, etc.)

 

 

 

 

3.2 , set only one controller: Test Plan -> Add -> THreads (User) -> jc @ uitimate thread group -> logic controllers -> only one controller -> Right Add -> assertion -> in response to the assertion

In response to the assertion (assertion is mainly used for the interface contains the contents of your expected return text)

 

 

 

 

 

3.3 , set the regular expression: Test Plan -> Add -> THreads (User) -> jc @ uitimate thread group -> logic controllers -> only one controller -> Right Add -> after postprocessor -> regular expression extractor

Regular expression extractor (extraction token is mainly used for the interface reference)

 

 

3.4 , set up debug sampler: Test Plan -> Add -> THreads (User) -> jc @ uitimate thread group -> logic controllers -> only one controller -> Right Add -> sampler- > debug sampler

debug sampler ( here mainly for easy viewing regular expressions when debugging)

 

 

 

 

 

4, http request (initialization page query) : Test Plan -> Add -> THreads (User) -> jc @ uitimate thread group -> logic controllers -> only one controller -> Right add - -> sampler -> http request

http request (initialization page query) :( the interface to obtain a regular expression token in order to carry out inquiries )

 

 

 

 

5 , view the result tree: Test Plan -> Right Add -> THreads (User) ---> jc @ Uitimdate thread group -> Right Add -> Listener -> View number of results ( you can view the request the content and return the body )

 

 

 

6 , see Aggregate Report: Test Plan -> Right Add -> THreads (User) ---> jc @ Uitimdate thread group -> Right Add -> Listener -> View Results tree ( see the request response time, etc. )

 

 

 

 

-

Guess you like

Origin www.cnblogs.com/luozqqin001/p/11404277.html