当前位置:网站首页>Project practice! Teach you JMeter performance test hand in hand
Project practice! Teach you JMeter performance test hand in hand
2022-06-28 04:44:00 【Wu_ Candy】
Today's share : How to use jmeter Perform performance testing , Take a specific project as an example to explain .
One 、 Directory structure
explain : Confirm that the input parameters of the transfer interface depend on : Foreground login interface and access submitToken Interface

Two 、 In the directory structure : Divestment projects --- test plan
The content is shown in the figure above
3、 ... and 、 In the directory structure : Confirmation of divestment --- Thread group
The content is shown in the figure below :

Four 、 In the directory structure : User parameters Fill in the login user name and password
The content is shown in the figure below :

5、 ... and 、 In the directory structure :BeanShellPreProcessor--- Preprocessor
The content is shown in the figure below :

java The code is :【 Use base64 Encrypt the user name and password 】
import org.apache.commons.codec.binary.Base64;
String username = vars.get("username");
String password = vars.get("password");
String combineduserpass = username + ":" + password;
byte[] encodedUsernamePassword = Base64.encodeBase64(combineduserpass.getBytes());
vars.put("auth",new String(encodedUsernamePassword)); remarks :
username--- In the user parameter : name
password---- In the user parameter : name
6、 ... and 、 In the directory structure :HTTP Header Manager
The content is shown in the figure below :

remarks :HTTP The name in the header manager is equivalent to python file headers Contents of Li
7、 ... and 、 In the directory structure :HTTP request — Foreground login interface
The content is shown in the figure below :

remarks :
Body Data Content :{"authorization": "Basic ${auth}"} This content is the input parameter of the login interface
Parameters auth yes BeanShellPreProcessor【 In the preprocessor :java The parameters returned by the code :auth】
8、 ... and 、 In the directory structure :HTTP request — Foreground login interface Look at the fruit tree
The content is shown in the figure below :

Nine 、 In the directory structure :HTTP request — Foreground login interface Sign in xAuthToken extract
The content is shown in the figure below :

Regular expression extractor : Get the information returned by the login interface :xAuthToken value
remarks :
1、 The reference name can be taken arbitrarily , But the name in the regular expression must match the name returned by the interface xAuthToken Keep the same name ;
2、 Generally get the first xAuthToken The value of appearance 【 Templates / Match the Numbers 】;
Ten 、 In the directory structure :HTTP request — obtain submitToken value
The content is shown in the figure below :

remarks :
1、 The interface requests to return submitToken value ;
2、 Input reference such as Body Data Shown ;
11、 ... and 、 In the directory structure :HTTP request — obtain submitToken value
submitToken extract 【 Regular expression extractor 】
The content is shown in the figure below :

remarks :
1、 Regular expression extractor , Reference names can be freely named , This name will be referenced later ;
2、 The name in the regular expression is : obtain submitToken Interface returned submitToken The name of the value of ;
3、 Generally, the first name returned by the interface is :submitToken The name of the value of , namely :submitToken;
Twelve 、 In the directory structure :HTTP request — obtain submitToken value Look at the fruit tree
The content is shown in the figure below :

13、 ... and 、 In the directory structure :HTTP request — Confirm the transfer interface
The content is shown in the figure below :

remarks :
1、Body Data In the submitToken Variable is :submitToken extract Regular expression extractor : Quote name submitToken;
2、 Confirm what is required for the transfer interface headers The information is already in the directory structure of :HTTP Header Manager ;
fourteen 、 In the directory structure :HTTP request — Confirm the transfer interface BeanShellPostProcessor
The content is shown in the figure below :

Code :prev.setDataEncoding("UTF-8");
solve : Chinese garbled code in the returned result of the interface ;
15、 ... and 、 In the directory structure :HTTP request — Confirm the transfer interface Look at the fruit tree
The content is shown in the figure below :

sixteen 、 In the directory structure :HTTP request — Confirm the transfer interface Response assertion
The content is shown in the figure below :

The red box is marked with : Confirm the contents that should be included when the transfer interface returns correctly ;
Welcome to your attention 【 The way of immeasurable testing 】 official account , reply 【 Claim resources 】
Python+Unittest frame API automation 、
Python+Unittest frame API automation 、
Python+Pytest frame API automation 、
Python+Pandas+Pyecharts Big data analysis 、
Python+Selenium frame Web Of UI automation 、
Python+Appium frame APP Of UI automation 、
Python Programming learning resources dry goods 、
Vue Front end component framework development 、
Resources and code Free ~
Below the official account is two-dimensional code. , You can directly scan wechat and pay attention .
remarks : My official account has been officially opened. , betake IT Sharing of Internet technology .
contain : Data analysis 、 big data 、 machine learning 、 Test Development 、API Interface automation 、 Test operation and maintenance 、UI automation 、 Performance testing 、 code detection 、 Programming technology, etc .
WeChat search official account :“ The way of immeasurable testing ”, Or scan the qr code below :

Add the attention , Let's grow together !
边栏推荐
- [small program practice series] e-commerce platform source code and function implementation
- Moonbeam集成Coin98,给予用户在多链道路上的更多选择
- Learning about DC-DC step-down chip of sy8120i (12V reduced to 3.3V)
- Aspnetcoreratelimit rate limit interface access limit current limit control
- The coming wave of Web3
- 有大佬出现过mysql cdc用 datastream时,出现重复binlog消息的情况吗
- Flinkcdc collects Oracle, and the Oracle database is CDB's
- E-week finance Q1 mobile banking has 650million active users; Layout of financial subsidiaries in emerging fields
- From zero to one, I will teach you to build a "search by text and map" search service (I)
- 控制器的功能和工作原理
猜你喜欢
![[small program practice series] e-commerce platform source code and function implementation](/img/a4/581d73c2ff5c190edc3d8438fa2122.png)
[small program practice series] e-commerce platform source code and function implementation

政策利好,20多省市开启元宇宙发展规划

Multi project design and development · introduction to class library project

有关函数模板的那些小知识-.-

控制器的功能和工作原理

Multithreading and high concurrency IV: varhandle, strong weak virtual reference and ThreadLocal

代码理解:IMPROVING CONVOLUTIONAL MODELS FOR HANDWRITTEN TEXT RECOGNITION

GO语言-select语句

Uncover the mystery of SSL and learn how to protect data with SSL

The coming wave of Web3
随机推荐
Sword finger offer 49 Ugly number (three finger needling technique)
The second round of free public classes of the red team is coming ~ 8:00 tomorrow night!
With favorable policies, more than 20 provinces and cities have launched the yuanuniverse development plan
Learning about DC-DC step-down chip of sy8120i (12V reduced to 3.3V)
Uncover the mystery of SSL and learn how to protect data with SSL
Ppt production tips
Analyse complète annuelle du marché chinois de l'audio en 2022
Oracledata installation problems
Code understanding: implementing volume models for hangwriten text recognition
With the transformation of automatic empowerment, Feihe dairy accelerates its move towards digitalization!
Is the securities account opened by qiniu safe? How to open an account
【Matlab红绿灯识别】红绿灯识别【含GUI源码 1908期】
Design a stack with getmin function
Necessary skills for test and development: actual combat of security test vulnerability shooting range
【Matlab BP回归预测】GA优化BP回归预测(含优化前的对比)【含源码 1901期】
抖音實戰~關注博主
云厂商为什么都在冲这个KPI?
100+数据科学面试问题和答案总结 - 机器学习和深度学习
Games104 operation 2-colorgrading
leetcode - 329. Longest increasing path in matrix