当前位置:网站首页>2022 the most complete and detailed JMeter interface test tutorial and detailed interface test process in the whole network - JMeter test plan component (thread < user >)
2022 the most complete and detailed JMeter interface test tutorial and detailed interface test process in the whole network - JMeter test plan component (thread < user >)
2022-06-24 10:27:00 【Test - Eight Precepts】
(1) Introduction of sampler
The sampler is used to simulate user operation , Send the request to the server and receive the response data from the server .
Samplers are components within thread groups , In other words, samplers can only be added to thread groups .
Sampler (Sampler) Send request to server in performance test , Record response information , The smallest unit that records the response time .( The sampler usually performs three tasks )
(2)JMeter Self contained sampler
HTTP Request:HTTP requestFlow Control Action: Test activitiesDebug Sampler:Debug SamplerJSR223 Sampler:JSR223 SamplerAJP/1.3 Sampler:AJP/1.3 SamplerAccess Log Sampler:Access Log SamplerBean Shell Sampler:Bean Shell SamplerFTP Request:FTP requestJDBC Request:JDBC RequestJMS Publisher:JMS ReleaseJMS Point-to-Point:JMS Point to pointJMS Subscriber:JMS subscribeJUnit Request:JUnit requestJava Request:Java requestLDAP Extended Request:LDAP Extension request defaultLDAP Request:LDAP requestOS Process Sampler:OS Process samplerSMTP Sampler:SMTP SamplerTCP Sampler:TCP SamplerMail Reader Sampler: Email reader sampler
explain :
- The most commonly used in testing is probably “HTTP request ”.
- Every different type of sampler Different types of requests can be made to the server according to the set parameters .
- stay JMeter All of the Sampler in ,
Java Request SamplerAndBean Shell SamplerIt's two special customizable Sampler.
summary :
- The role of the sampler is to send requests to the server , Record response information , Record the response time .
- Multiple samplers run in the order they appear in the tree .
(3)“HTTP request ” Let's introduce the sampler as an example

According to the illustration above :
HTTP Request:
name (Name): Sampler name , That is, the name of the interface to be accessed .
It is suggested to write the address of the request interface , for example :/loginSo when there are multiple samplers , The list on the left shows which interface the sampler is for .notes (Comments): An explanation of the current sampler .
Web The server :
agreement <Protocol(http)>: Send to the target server HTTP Protocol at request time , It can be http Or is it https perhaps File , The default value is http agreement ( According to the demand ).Server name or IP(Server Name or IP):HTTP Request to send the domain name or IP Address , for examplewww.baidu.comperhaps127.0.0.1.Port number (Port Number): The port occupied by the application in the accessed server , Default 80 port .
HTTP request :
1) Method (Method):
send out HTTP How to request .( It can be obtained from the interface document )
The methods of request include :GET、POST、HEAD、PUT、OPTIONS、TRACE、DELETE etc. .
2) route (Path):
Target interface URL route ( Server address and port are not included ).
You can also write the full path directly ( Configured above IP+ Ports can be omitted ) , No parameters api route .
3) Content encoding (Content encoding):
The encoding of the request data content , The default value is iso8859 code , But not so content encoding Configure to UTF-8, To prevent Chinese garbled .
Explain Content encoding attribute :Accept-Encoding and Content-Encoding yes HTTP A pair of header fields used to agree on which encoding format to use to transmit the text .
Here's how it works :
1、 First browser ( That's the client side ) When sending a request , adopt Accept-Encoding Bring your own list of supported content encoding formats .
2、 The server receives the request , Choose one of them to encode the response information , And pass Content-Encoding To illustrate the coding information selected by the server .
3、 After the browser gets the response text , basis Content-Encoding unpack .
4) Automatic redirection :
If this option is selected , When sending HTTP The response is 302/301 when ,JMeter Will automatically redirect to a new page , however JMeter Do not record the process content of redirection . It can only be used for GET and HEAD Method , If it is POST perhaps PUT The request is not sent by the sampler .
301、302 Response code description :
The official explanation is more concise :
- 301 redirect:301 Represents a permanent transfer (Permanently Moved)
- 302 redirect: 302 Represents a temporary transfer (Temporarily Moved )
In detail ,
What they have in common 301 and 302 Status codes all indicate redirection , That is to say, the browser will automatically jump to a new one after getting the status code returned by the server URL Address , This address can be answered from Location Get... In the first part ( The effect the user sees is the address he enters A In an instant, it becomes another address B)
The difference between them is .301 Old address A Has been permanently removed ( This resource is inaccessible ), The search engine grabs the new content and exchanges the old URL with the redirected one ;302 Old address A Our resources are still there ( Still accessible ), This redirect is only temporarily from the old address A Jump to address B, Search engines will grab new content and save old URLs .
summary :
http Agreed 301 and 302 Status codes all represent redirection . The browser requests url When these two status codes are received , Will show and jump to Response Headers Medium Location. That is, input the address in the browser url A, But automatically jump to url B.
5) Follow the redirect :Http Request Default options for samplers , When the response code yes 3xx when , Automatically jump to the destination address . Unlike automatic redirection ,JMeter All request responses during redirection will be recorded , When viewing the result tree, you can see the content returned by the server , If there are multiple jumps, multiple requests will be recorded , This is the default option .
The difference between automatic redirection and follow-up redirection is only whether to record multiple jump requests .
stay JMeter Selected by default Follow the redirect , but Follow the redirect And Automatic redirection You can only choose one .
a key : Supporting learning materials and video teaching
So here I have carefully prepared the detailed information of the above outline in The link below is as follows


边栏推荐
- 美国电子烟巨头 Juul 遭遇灭顶之灾,所有产品强制下架
- [EI分享] 2022年第六届船舶,海洋与海事工程国际会议(NAOME 2022)
- SQL Sever中的窗口函数row_number()rank()dense_rank()
- Juul, the American e-cigarette giant, suffered a disaster, and all products were forced off the shelves
- Leetcode-223: rectangular area
- Web site development, lazy image loading
- np.float32()
- 抓包工具charles实践分享
- 整理接口性能优化技巧,干掉慢代码
- 小程序 rich-text中图片点击放大与自适应大小问题
猜你喜欢

线程的 sleep() 方法与 wait() 方法的区别
![[resource sharing] 2022 International Conference on Environmental Engineering and Biotechnology (coeeb 2022)](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[resource sharing] 2022 International Conference on Environmental Engineering and Biotechnology (coeeb 2022)

283.移动零

uniapp 开发微信公众号,下拉框默认选中列表第一个

自定义kindeditor编辑器的工具栏,items即去除不必要的工具栏或者保留部分工具栏

抓包工具charles实践分享

6. package management business development

HBuilder制作英雄皮肤抽奖小游戏

How large and medium-sized enterprises build their own monitoring system

解决Deprecated: Methods with the same name as their class will not be constructors in报错方案
随机推荐
Engine localization adaptation & Reconstruction notes
2022年能源与环境工程国际研讨会(CoEEE 2022)
leetCode-1051: 高度检查器
【IEEE出版】2022年智能交通与未来出行国际会议(CSTFM 2022)
自定义kindeditor编辑器的工具栏,items即去除不必要的工具栏或者保留部分工具栏
利用pandas读取SQL Sever数据表
p5.js实现的炫酷交互式动画js特效
抓包工具charles實踐分享
线程调度的常用方法
Leetcode-223: rectangular area
leetCode-1823: 找出游戏的获胜者
Using pandas to read SQL server data table
How large and medium-sized enterprises build their own monitoring system
Flink集群搭建以及企业级yarn集群搭建
Learn to use the phpstripslush function to remove backslashes
Normal equation
leetCode-929: 独特的电子邮件地址
线程池的执行流程
3.员工的增删改查
线程池的状态