Python (5) uses Jmeter to realize high-concurrency interface automation

Preface

The process of postman's implementation of interface automation has been explained in the previous blog, but postman is essentially unable to achieve concurrent access. Even if the delay request time is set to 0, he essentially iterates the request interface one by one,
so it has limitations. , This article mainly talks about using Jmeter to achieve high-concurrency interface automation

Postman realizes interface automation address: https://blog.csdn.net/Makasa/article/details/112321078



One, operation ideas

My steps are generally like this:

  • 1.First of all, the interface to be called will be manually created and called in postman to test whether the call is successful.

  • 2. After the call is successful, check which request parameters of the interface need to be changed, then use python to make these parameters and write them into txt or csv.

  • 3. Then open Jmeter to automatically configure some components, fill in the information, and click execute

The preparation steps for the first two steps are the same as [Postman realizes interface automation]. For details, please refer to the previous blog. I will not talk about it here, but mainly describe the third step of Jmeter configuration and execution.


2. Jmeter configuration and execution

1) First open Jmeter and create a thread group

Insert picture description here

2) Create a header manager to configure related request headers
Insert picture description here
Insert picture description here

3) Create an http request and fill in relevant information
Insert picture description here
Insert picture description here

4) Create CSV Data Set Config for parameterized data configuration

Insert picture description here
Insert picture description here
Data text
Insert picture description here

5) Create related and easy-to-view components [view result count/aggregate report/graphic result]

Insert picture description here
6) If you want to perform concurrent access, set the number of threads
Insert picture description here
7) Click Run to view the result
Insert picture description here

Insert picture description here
Insert picture description here
Insert picture description here


Three, summary

In fact, it is not difficult to automate the interface of postman and Jmeter. You only need to configure some related things. The
main thing is to make preparations and use python to achieve automatic data generation.

Guess you like

Origin blog.csdn.net/Makasa/article/details/112327181