当前位置:网站首页>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
边栏推荐
- Simulation lottery and probability statistics experiment of the top 16 Champions League
- 等保备案是等保测评吗?两者是什么关系?
- Difference between map and object
- When querying the database with Gorm, reflect: reflect flag. mustBeAssignable using unaddressable value
- 全上链哈希游戏dapp系统定制(方案设计)
- Dx12 engine development course progress - where does this course go
- Leetcode(146)——LRU 缓存
- 基于QT+MySQL的相机租赁管理系统
- What does virtualization mean? What technologies are included? What is the difference with private cloud?
- After 5 months' test, it took 15K to come for an interview. When I asked, it was not worth even 5K. It was really
猜你喜欢

"Ningwang" was sold and bought at the same time, and Hillhouse capital has cashed in billions by "selling high and absorbing low"

Memo mode - game archiving

Nifi fast authentication configuration

I feel that I am bald again when I help my children with their homework. I feel pity for my parents all over the world

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

yeb_ Back first day

Does the developer want to change to software testing?

Procedural life: a few things you should know when entering the workplace

Interpreter mode -- formulas for dating

After idea installs these plug-ins, the code can be written to heaven. My little sister also has to arrange it
随机推荐
Docker deploy mysql5.7
C語言實現掃雷(簡易版)
基于QT+MySQL的相机租赁管理系统
Builder mode -- Master asked me to refine pills
Selenium crawl notes
Design of routing service for multi Activity Architecture Design
Prototype mode -- clone monster Army
Power apps Guide
I feel that I am bald again when I help my children with their homework. I feel pity for my parents all over the world
Rename and delete files
图的基本概念以及相关定义
刚购买了一个MYSQL数据库,提示已有实例,控制台登录实例要提供数据库账号,我如何知道数据库账号。
Read all text from stdin to a string
Nifi fast authentication configuration
虚拟化是什么意思?包含哪些技术?与私有云有什么区别?
Leetcode(455)——分发饼干
物聯網?快來看 Arduino 上雲啦
顺序表的基本操作
CVPR 2022 remembers Sun Jian! Tongji and Ali won the best student thesis award, and hekaiming was shortlisted
Postman assertion