当前位置:网站首页>JMeter starts from zero (III) -- simple use of regular expressions
JMeter starts from zero (III) -- simple use of regular expressions
2022-07-03 03:53:00 【noobTest】
This paper introduces Jmter When sending a request , A common situation :
Suppose we need to send a request , This request requires a parameter , But this parameter is not fixed , He was the last one who asked to return , And it's different every time I return , What should we do at this time ?
First , We create a HTTP Request , That is, pre request , The method is the same as that introduced in the previous article , Add thread group , establish HTTP request , Add view result tree , Then start
Pictured , This is the result of our pre request , For example, we need to use the one marked in the red box for our next request ID:13010051
First, we create a regular expression extractor in this request
Then return to the result tree just now , Left selection is RegExp Tester, In this way, the view on the right side is more organized , then , image Loadrunner Left and right boundary values , Paste the left and right parameters we need into the text box below , Then we use the part we need (.*?) Instead of
Be careful : Not all of them should be used (.*?) Instead of , Here are the rules :
How to check whether we can get the right value by writing like this ? On the right side of the text box is a test Button , Click to view the sampling results :
It's the same as we expected , Here we are 13010051, Then we paste the contents of the text box into the regular expression sampler .
There's a pit here , It's the template. , Don't write nonsense , Don't forget to write , Here are the following rules :
For example, we need to take values in the following responses :
"HeatPowerPlantID":"A","HeatPowerPlantName":"jmeter test "."HeatPowerPlantID":"B","HeatPowerPlantName":"jmeter test ".
Regular expression extractor template , Style is :$n$.
If the template is :$0$, Is what the entire expression matches , It includes the contents inside and outside the parentheses , The value obtained is the whole content , namely :
"HeatPowerPlantID":"A","HeatPowerPlantName":"jmeter test "."HeatPowerPlantID":"B","HeatPowerPlantName":"jmeter test ".
If the template is :$1$, Then it corresponds to the first (.*?) What matches , namely A
If the template is :$2$, Then it corresponds to the second in the regular expression (.*?) What matches , namely B
If the template is $1$$2$, Then put 2 individual (.*?) The matched content is spliced , namely AB.
Templates can be combined freely , In the following cases .
Now our regular expression is done , How to use the next request , We create the next HTTP request , And add parameters :
The parameters we get a , As the parameter of the next request , The name of this parameter is heatPowerPlantIDs, Its value is in our regular expression a, It is written here as :${a}
So far, parameterization is completed ,PS: comparison loadrunner Parametric Association of ,Jmeter I feel a little troublesome , But the principle is the same , The parameter position is determined by the left and right boundary values , And then take .
Then we click Run , You can see in the result tree , The request is successful , We successfully deleted ID by 13010051 The data of
边栏推荐
- For instruction, uploading pictures and display effect optimization of simple wechat applet development
- Open Visual Studio 2010 hangs when opening a SQL file sql file
- C语言HashTable/HashSet库汇总
- 2020-01-01t00:00:00.000000z date format conversion
- Null and undefined
- PHP generates PDF tcpdf
- Web会话管理安全问题
- Appium自动化测试框架
- How to execute a swift for in loop in one step- How can I do a Swift for-in loop with a step?
- Error c2694 "void logger:: log (nvinfer1:: ilogger:: severity, const char *)": rewrite the restrictive exception specification of virtual functions than base class virtual member functions
猜你喜欢
递归:快速排序,归并排序和堆排序
Bid farewell to artificial mental retardation: Mengzi open source project team received RMB 100 million financing to help NLP develop
Mongodb replication set [master-slave replication]
Ffmpeg recording screen and screenshot
TCP, the heavyweight guest in tcp/ip model -- Kuige of Shangwen network
Ffmpeg download and installation tutorial and introduction
2022 polymerization process examination questions and polymerization process examination skills
Mongodb installation & Deployment
Introduction to mongodb
简易版 微信小程序开发之页面跳转、数据绑定、获取用户信息、获取用户位置信息
随机推荐
SAP ui5 application development tutorial 105 - detailed introduction to the linkage effect implementation of SAP ui5 master detail layout mode
IPv6过渡技术-6to4手工隧道配置实验--尚文网络奎哥
Error c2694 "void logger:: log (nvinfer1:: ilogger:: severity, const char *)": rewrite the restrictive exception specification of virtual functions than base class virtual member functions
User value is the last word in the competition of mobile phone market
Mongodb installation & Deployment
Simple wechat applet development page Jump, data binding, obtaining user information, obtaining user location information
记一次 .NET 差旅管理后台 CPU 爆高分析
[embedded module] OLED display module
TCP/IP模型中的重磅嘉宾TCP--尚文网络奎哥
Numpy warning visibledeprecationwarning: creating an ndarray from ragged needed sequences
Bisher - based on SSM pet adoption center
Appium自动化测试框架
Summary of electromagnetic spectrum
numpy之 警告VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences
在写web项目的时候,文件上传用到了smartupload,用了new string()进行转码,但是在数据库中,还是会出现类似扑克的乱码
Nanning water leakage detection: warmly congratulate Guangxi Zhongshui on winning the first famous brand in Guangxi
2022 P cylinder filling examination content and P cylinder filling practice examination video
ffmpeg录制屏幕和截屏
TCP, the heavyweight guest in tcp/ip model -- Kuige of Shangwen network
Pytorch multi card distributed training distributeddataparallel usage