当前位置:网站首页>Software testing skills, JMeter stress testing tutorial, obtaining post request data in x-www-form-urlencoded format (24)
Software testing skills, JMeter stress testing tutorial, obtaining post request data in x-www-form-urlencoded format (24)
2022-07-03 20:56:00 【Test pursuit】
Catalog : Reading guide
One 、 Preface
post Some of the requested parameters are json Format , There are also some x-www-form-urlencoded Format , When we talked about signature, we got post The request is json Format
This article continues x-www-form-urlencoded Format request body How to get
Two 、x-www-form-urlencoded
Add... To the request header Content-Type The type is x-www-form-urlencoded
Define user variables , Account and password 
post Request parameter to fill in key value pair 
3、 ... and 、BeanShell Preprocessor
add to - Preprocessor -BeanShell Preprocessor 
Use getArgumentsAsMap() Method to get a request for a key value pair body
import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.config.Argument;
import org.json.JSONObject;
import org.json.JSONArray;
import org.apache.commons.codec.digest.DigestUtils; // Import md5 Encrypted package
Arguments arguments = sampler.getArguments();
Map reqMap = arguments.getArgumentsAsMap();
log.info("------------------------body------------------");
for (String key : reqMap.keySet()) {
log.info("key: " + key + ",value: " + reqMap.get(key));
}
log.info(reqMap.get("username"))

Four 、 View the run results
The number of results can be viewed from the request header parameter type 
request body data :username=test&password=123456

边栏推荐
- Basic number theory -- Chinese remainder theorem
- 6006. Take out the minimum number of magic beans
- Memory analyzer (MAT)
- 内存分析器 (MAT)
- Go learning notes (4) basic types and statements (3)
- Plan for the first half of 2022 -- pass the PMP Exam
- App compliance
- Producer consumer mode (multithreading, use of shared resources)
- MySQL learning notes - single table query
- Transformation between yaml, Jason and Dict
猜你喜欢

Test changes in Devops mode -- learning and thinking

LabVIEW training

全网都在疯传的《老板管理手册》(转)

Apprentissage intensif - notes d'apprentissage 1 | concepts de base

2022 low voltage electrician examination and low voltage electrician simulation examination question bank

Interval product of zhinai sauce (prefix product + inverse element)

Rhcsa third day operation

Go learning notes (4) basic types and statements (3)

JMeter plug-in installation

SQL injection - Fundamentals of SQL database operation
随机推荐
Test changes in Devops mode -- learning and thinking
Ask and answer: dispel your doubts about the virtual function mechanism
Yyds dry goods inventory TCP & UDP
JVM JNI and PVM pybind11 mass data transmission and optimization
C 10 new feature [caller parameter expression] solves my confusion seven years ago
Research Report on the overall scale, major manufacturers, major regions, products and application segmentation of rotary tablet presses in the global market in 2022
2.5 conversion of different data types (2)
Shortest path problem of graph theory (acwing template)
Assign the CMD command execution result to a variable
Brief analysis of ref nerf
Hcie security Day10: six experiments to understand VRRP and reliability
[Yugong series] February 2022 Net architecture class 004 ABP vNext used in WPF project
"Designer universe" APEC safety and health +: environmental protection Panda "xiaobaobao" Happy Valentine's Day 2022 | ChinaBrand | Asia Pacific Economic media
2022 melting welding and thermal cutting examination materials and free melting welding and thermal cutting examination questions
How to modify the network IP addresses of mobile phones and computers?
不同业务场景该如何选择缓存的读写策略?
The global industrial design revenue in 2021 was about $44360 million, and it is expected to reach $62720 million in 2028. From 2022 to 2028, the CAGR was 5.5%
In 2021, the global revenue of syphilis rapid detection kits was about US $608.1 million, and it is expected to reach US $712.9 million in 2028
Machine learning support vector machine SVM
Custom view incomplete to be continued