当前位置:网站首页>JMeter interface test, associated interface implementation steps (token)

JMeter interface test, associated interface implementation steps (token)

2022-06-25 08:56:00 fish_ study_ csdn

Catalog

Catalog

         1、 Create a new thread group in the test plan , Create a new login in the thread group http request

2 、 Add a regular extractor :

3、 Let's create another one http request , Need to use token

4、 Let's create another one http Request header

5 、 Send a request :

6 、 In addition to using regular, you can also use json Extractor

6.1 Disable the original regular extractor

6.2 Logged in at http Request to create a json Extractor

6.3 Use token The query interface of does not change

6.4 Query interface OK


jmeter When used for interface test , The latter interface often needs to use the results returned by the previous interface , How to get the result value of the previous request , Applied to the latter interface ?

There are generally regular extractors and json Two types of extractors


Take a login example to illustrate , To get the comment list, you need to log in to view

1、 Create a new thread group in the test plan , Create a new login in the thread group http request

2 、 Add a regular extractor :

Regular expressions match to token Value , Assigned to a variable dlt

Quote name : Self defined variable name , The variable name to be referenced by subsequent requests , If you fill in :dlt, The following quotation method is ${dlt}
Regular expressions : Extract regular expressions for content , amount to lr Correlation function in
【() The enclosed parts need to be extracted , You need to enclose the content in brackets 】
【. The dot means match any string 】
【+ Once or more 】
【? Stop after first match found 】

 Insert picture description here

3、 Let's create another one http request , Need to use token

 4、 Let's create another one http Request header

5 、 Send a request :

6 、 In addition to using regular, you can also use json Extractor

I didn't rebuild a thread group , Based on the original thread group

6.1 Disable the original regular extractor

6.2 Logged in at http Request to create a json Extractor

6.3 Use token The query interface of does not change

 

6.4 Query interface OK

 

原网站

版权声明
本文为[fish_ study_ csdn]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206250808335850.html