当前位置:网站首页>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
边栏推荐
- Postman assertion
- Camera rental management system based on qt+mysql
- Use the transparent [x] cross button image in the dialog
- JMeter installation plug-in, adding [email protected] -Perfmon metric collector listener steps
- Dongyuhui is not enough to bring goods to "rescue" live broadcast
- Wechat applet custom tabbar
- Apple, Microsoft and Google will no longer fight each other. They will work together to do a big thing this year
- 畅直播|针对直播痛点的关键技术解析
- Leetcode (146) - LRU cache
- Format method and parse method of dateformat class
猜你喜欢

Responsibility chain mode -- through interview

Leetcode (135) - distribute candy

Two fellow countrymen from Hunan have jointly launched a 10 billion yuan IPO

使用gorm查询数据库时reflect: reflect.flag.mustBeAssignable using unaddressable value

Background operation retry gave up; KeeperErrorCode = ConnectionLoss

A/b test helps the growth of game business

After a few years in the testing industry, do you still know a little?

Static routing job supplement

A/B测试助力游戏业务增长

海泰前沿技术|隐私计算技术在医疗数据保护中的应用
随机推荐
Adding subscribers to a list using mailchimp's API V3
2021-09-30
Rip/ospf protocol notes sorting
Memo mode - game archiving
顺序表的基本操作
The difference between RPC and restful
C language to realize mine sweeping (simple version)
Leetcode (455) - distribute cookies
C langage pour le déminage (version simplifiée)
When querying the database with Gorm, reflect: reflect flag. mustBeAssignable using unaddressable value
After a few years in the testing industry, do you still know a little?
Design of routing service for multi Activity Architecture Design
Pyaudio audio recording
Variable setting in postman
What does virtualization mean? What technologies are included? What is the difference with private cloud?
The AI for emotion recognition was "harbouring evil intentions", and Microsoft decided to block it!
After idea installs these plug-ins, the code can be written to heaven. My little sister also has to arrange it
Two fellow countrymen from Hunan have jointly launched a 10 billion yuan IPO
A/b test helps the growth of game business
Power apps Guide