当前位置:网站首页>JMeter basic learning records
JMeter basic learning records
2022-06-24 21:06:00 【gchh_ spring】
1、HTTP Request defaults
effect :
1、 Request default value can set the default value of request parameters 、 request url The default value of , If there are more than one http The body of the request is consistent , Then it can be set to the default value , Prevent a large number of changes after changes http request , Can play a good reuse effect
2、 If in a single http The request adds the same parameter as the default value , Is a single http The requested parameters prevail , At this time, the default value is set to this http Invalid , The default value takes effect only when no parameters are filled in

How to add :

2、HTTP Header Manager
effect :
You can customize the value of the header field through the header manager , For example, modify User-Agent Change the value of to another value ( The screenshot has not been changed ,Value Values can be entered by yourself )

How to add :

3、 User defined variables
effect :
It's going on http When asked , If the value of a parameter requires multiple tests , Then you can customize the variables , At the same time http Call the user-defined variable in the request parameter , Call mode :${ Variable name }, such as ${date1}

How to add :

4、 Request element -- A parameterized txt
effect :
User defined variables can be written to txt In file , By adding CSV Date Set Config Components , take txt Document import , Define variable name , Loop through the test txt Multiple lines of data in the document , This can reduce http Number of requests created
such as , There is a login interface , You will design normal login 、 Wrong user name 、 Wrong password 、 User name is empty 、 The password is empty. 、 All are empty use cases , So you can create a txt file , Write your test data in the following format
stay http Request in sampler , Get by calling variables txt Value information of , If you need to traverse txt All values in it , You can set the number of cycles to 6( Because our data is 6 strip , Set... According to the actual situation ), Then you can loop through txt The data in it


How to add :

5、 Request element -- A parameterized csv
effect :
A parameterized csv Same as txt It's the same operation , Only the imported file becomes csv file ( You can create excel Save as after csv file ),csv Is text in tabular format , For data creation and data viewing txt It is better to
6、 Parameterized function assistant _CSVRead
effect :
By using jmeter Internal function _CSVRead Read csv File content to parameterize http Request data , Practical and parametric csv similar , It's just a function call , Finally, the variable name generated by the calling function is called
In the function dialog box in the figure below , If you want to get information about the second column and the number of subsequent columns , Then fill in the column information separately 1,2,... equivalence
By function _CSVRead Get the parameter value information , If you want to traverse all the parameters set in the file , Then set the value of the number of threads in the thread group to the actual number of parameter lines , Instead of setting the number of cycles
How to use :
Open function assistant :

Function Assistant dialog :

How to call the variables generated by the function assistant :

7、 Parameterized function assistant _randomstring
effect :
Call this function to automatically generate random data , To some extent, you don't have to prepare the test data yourself , But this method can not guarantee the uniqueness of the data , Because the randomly generated data may be duplicated
Use the same way as csvread Function similar to , The following figure shows how to use and generate
How to use :

8、 The regular expression extractor gets the response result
effect :
You can extract the content you want from the specified response data : Both header and response data can be extracted
Regular expression extractors must be added under a request , As its sub request , Otherwise, the specified data cannot be extracted
How to use :
1、 In extractor ( such as http request ) Now create a regular expression extractor , Then fill in the information of the extractor


2、 How to view the extraction results of regular expressions :
First, add... Under the thread group Debug Sampler, After operation , View the extracted information under the view result tree


Be careful : If one sampler needs to use the regular extractor values of other samplers , Then this sampler should be placed in front of the sampler that references it , The variables and variable values in the regular extractor can be obtained normally

Normal after position change


9、 The regular expression extractor gets an array
effect :
Last summary ( The first 8) It only shows how to get one or more data from one data , So this is to obtain data information from multiple data
How to use :

10、 Logic controller -foreach controller
effect :
You can traverse the values of some similar variables
How to use :


11、json path The extractor gets the response result
effect :
The returned data is json When formatting data , have access to json Extractor to get the information in the response data
How to use :


jsonpath grammar :$ Represents the root path
12、jmeter Of cookie Processing mode - add to http cookie Manager
effect :
add to cookie Information , It can guarantee the success of subsequent request operations
How to use :

Add... In addition cookie You can also use the regular expression extractor to get cookie Information , And will cookie The information is placed in the next request header , It is possible to manually cookie Information added to cookie Manager
边栏推荐
- Rip/ospf protocol notes sorting
- Splicing audio files with ffmpeg-4.3
- Visitor model -- generation gap between young and middle-aged people
- Image panr
- Undo log and redo log must be clear this time
- Two fellow countrymen from Hunan have jointly launched a 10 billion yuan IPO
- Mr. Hu Bo, CIO of weiduomei, a scientific innovator: digitalization is a bloodless revolution, and the correct answer lies in the field of business
- VMware virtual machine setting static IP
- Record a deletion bash_ Profile file
- CVPR 2022 remembers Sun Jian! Tongji and Ali won the best student thesis award, and hekaiming was shortlisted
猜你喜欢

Common data model (updating)

Byte and Tencent have also come to an end. How fragrant is this business of "making 30million yuan a month"?

The difference between RPC and restful

红象云腾完成与龙蜥操作系统兼容适配,产品运行稳定

Static routing job supplement

Memo mode - game archiving

网络安全审查办公室对知网启动网络安全审查

After idea installs these plug-ins, the code can be written to heaven. My little sister also has to arrange it

Combination mode -- stock speculation has been cut into leeks? Come and try this investment strategy!

得物多活架构设计之路由服务设计
随机推荐
网络安全审查办公室对知网启动网络安全审查
主数据建设的背景
What are the problems with traditional IO? Why is zero copy introduced?
Berkeley, MIT, Cambridge, deepmind et d'autres grandes conférences en ligne: vers une IA sûre, fiable et contrôlable
Sequence stack version 1.0
C語言實現掃雷(簡易版)
Packaging_ Conversion between basic type and string type
Common member methods of the calendar class
After idea installs these plug-ins, the code can be written to heaven. My little sister also has to arrange it
Vant component used in wechat applet
基于QT+MySQL的相机租赁管理系统
Leetcode (455) - distribute cookies
Pyaudio audio recording
Agency mode -- Jiangnan leather shoes factory
DAPP system customization of full chain hash game (scheme design)
科创人·味多美CIO胡博:数字化是不流血的革命,正确答案藏在业务的田间地头
List set Introduction & common methods
After 5 months' test, it took 15K to come for an interview. When I asked, it was not worth even 5K. It was really
The difference between RPC and restful
Stackoverflow annual report 2022: what are developers' favorite databases?