当前位置:网站首页>Examples of application of JMeter in performance testing
Examples of application of JMeter in performance testing
2022-07-28 01:00:00 【51CTO】
Jmeter Examples of application practice in performance testing in a project
I practiced again some time ago , be based on JMeter Have a performance test . I made a brief arrangement yesterday , Wrote a document , Now share here .
Organization | Nianhuaiju | date | 2016-01-26 |
to examine |
| date |
|
Release |
| date |
|
Release |
| date |
|
Change record
* The revision types are divided into A - ADDED M - MODIFIED D – DELETED
notes : Add 、 This record is required for deletion or modification , Record the change information in detail , To ensure its traceability
Catalog
Catalog
1 Purpose of the document :
2 Scope of application :
3 reference :
4 Dubbo Interface test code writing
4.1 Create a project , And import dependent packages
4.2 Jmeter Medium case structure (JavaSamplerClient)
4.3 Generate class Executable file
5 Jmeter Test execution in
5.1 New test plan
5.2 Configure thread groups
5.3 add to java request
5.4 Add timers
5.6 Add monitor :Transactions per Second
5.7 Add monitor :Transaction Throughtput vs Threads
5.5 Add aggregation report
5.8 Other extensions : Preprocessor
5.9 Other extensions : Assertion
6. The test execution
7. remarks
1 Purpose of the document :
This document is mainly about Jmeter An application practice in the process of practicing the test project , Make a brief description , For by Dubbo Interface , After the processing of the message center and MQ Distribution of , as well as MySQL Put in storage \ The test methods involved in the whole process of sending to the gateway , Make some brief explanations .
2 Scope of application :
This document is mainly applicable to testing , Yes JMeter Unknown testers , Familiar with or already proficient in JMeter People can ignore .
3 reference :
Jmeter API:
http://jmeter.apache.org/api/
4 Dubbo Interface test code writing
4.1 Create a project , And import dependent packages
Dependency package , It has two parts : One part is pressure measuring tools Jmeter Required dependency package , See the screenshot below

Another part , It is a business-related dependency package :jmeter-haotest-server.jar;
Will be related to lib bag jmeter The catalog of ${Jmeter_home}\apache-jmeter-2.13\lib\ext below , And then jar Package imported into the eclipse in .
The configuration file :


View Code
4.2 Jmeter Medium case structure (JavaSamplerClient)
We jmeter One of the complete case To inherit JavaSamplerClient This class , After inheriting this class , stay eclipse Methods that need to be rewritten will be automatically generated in , These methods are the main part of our document .
The following code example :
The description of these methods is added to the example , Next, I will introduce how each method completes code development .
TestInit.java: Initialize the base class


View Code
JMeterTestSendTemplateMsgByEmail.java:
Dubbo Interface class


View Code

4.3 Generate class Executable file
After the code is adjusted , Need to re clean, and run Generate the compiled executable ;
Then connect bin Catalog together copy To Jmeter In machine , Standard machine is ${jmeter_workspace_home};
5 Jmeter Test execution in
After the relevant script debugging passes , You can use pressure measuring tools Jmeter In the implementation of :
start-up D:\apache-jmeter-2.13\bin\jmeter.bat
open ${jmeter_workspace_home}\scenarios\JMeterTestSendTemplateMsgByWeChat.jmx
function , And monitor the input of the process .

The previous process is described in detail below :
5.1 New test plan
adopt “ file ”-->“ newly build ”, Add a test plan ;
5.2 Configure thread groups

As shown in the figure above , In the test plan , Add thread group ;
5.3 add to java request

Add... Under thread group Java request , As shown in the figure above . Add the results as follows :

In the main window after adding , Select the class to be measured , And add corresponding parameters .
Include the name of the parameter 、 value ;
After adding , Preservation .
5.4 Add timers

According to need , Some pressure tests need to add timers , In the thread group , add to --> Timer --> Fixed timer ;
give the result as follows :

According to need , And configure the thread delay of the fixed timer ;
Add results :

5.6 Add monitor :Transactions per Second

During the test , We need to monitor relevant tps, And the thread of transaction processing ;
Then you can add corresponding items in the monitor , It is used to get relevant data after subsequent test execution ;

As shown in the figure above , After adding , During test execution , In real time tps situation , It can be shown in the above table ;
5.7 Add monitor :Transaction Throughtput vs Threads

Transaction throughtput vs threads Method and tps identical ;
The monitoring results are the same , It will be displayed in real time during the implementation ;
An example is shown below :

*********
5.8 Add aggregation report

By choice Thread group --> Monitor --> Aggregation report , After adding the aggregation report , You can see the overall results in the aggregation report ;
An example of an aggregation report is as follows :
Label | # Samples | Average | Median | 90% Line | 95% Line | 99% Line | Min | Max | Error % | Throughput | KB/sec |
TestSendTemplateMsgByWeChat | 9531 | 40 | 22 | 96 | 124 | 188 | 2 | 630 | 0.00% | 55.7 | 0 |
The overall | 9531 | 40 | 22 | 96 | 124 | 188 | 2 | 630 | 0.00% | 55.7 | 0 |
*
********
5.9 Other extensions : Preprocessor

For the testing of some scenarios , It may be necessary to prepare embedded data ;
Adding a preprocessor can help solve these problems ;
5.10 Other extensions : Assertion

Assertion , seeing the name of a thing one thinks of its function , Add assertions , After the test , By assertion , Direct verification and marking case Whether to pass ;
6. The test execution
Monitor relevant data during execution , And get relevant reports .
Here are some examples of test execution results ;

The figure above is an interface test TPS Result pictures ;

The figure above is an interface test thread Picture of situation results ;
7. remarks
JMeter There are more scenarios for the use of ;
This article is only a basic use example , Want to know more about , Then gradually add ;
A supplementary service started shell


View Code
Because it was written first word file , The format may change slightly here .
A gift of rose
Fragrance in hand
We were so eager for the waves of fate , Until the end : The most graceful scenery of life , Is the heart of calm and calm …… We used to look forward to recognition , Not until the end : The world is its own , Have nothing to do with others !- Mr. Yang Jiang
边栏推荐
- Leetcode 415. string addition and 43. string multiplication
- Leetcode:1997. the first day after visiting all rooms [jump DP]
- Network equipment hard core technology insider firewall and security gateway (11) secrets of zero contact office
- Set 数据构造函数
- 投资80亿!南京华天封测一期项目即将投产!
- Ddt+yaml implementation of data driven mechanism based on unittest
- [CruiseControl]Build Result JSP
- What is the org relationship mitigation strategy of Microsoft edge browser tracking prevention
- Redis-三大特殊数据类型的学习和理解
- The program design questions of the 11th national competition of Bluebridge cup single chip microcomputer
猜你喜欢
随机推荐
跨桌面端Web容器演进
函数相关知识
MySQL limit usage and large paging problem solving
startUMl
Current situation of semiconductor testing equipment Market: the localization rate is still less than 10%!
Sign up now | cloud native technology exchange meetup Guangzhou station has been opened, and I will meet you on August 6!
推荐系统-指标:ctr、cvr
Interesting Huffman tree
Jerry's Bluetooth can only link back to the last device [article]
Jerry caused other messages to accumulate in the message pool [article]
【原】【爬虫系列】简要获取一下知乎的最热门话题相关主题及描述信息
共创文旅新篇章|新起典与国华文旅签订战略合作协议
[CruiseControl]Build Result JSP
推荐系统-精排模型:xDeepFM
From the second floor to the third floor
网络设备硬核技术内幕 防火墙与安全网关篇 (小结)
Set data constructor
Network device hard core technology insider firewall and security gateway (IX) virtualization artifact (II)
canvas模拟输入框输入
Multithreading & high concurrency (the latest in the whole network: interview questions + map + Notes) the interviewer is calm
![[CruiseControl]Build Result JSP](/img/80/11c2b539c217ecd6ba55668d3e71e9.png)







