当前位置:网站首页>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
边栏推荐
- Valued at $36billion! SpaceX, which is about to launch its first manned launch, raised $346million
- Arm releases the new a78/g78/n78 kernel! There is also a cortex-x Series CPU that supports customization
- Code review tool
- 592. Fraction addition and subtraction: introduction to expression calculation
- 7. Typescript part Foundation
- From the second floor to the third floor
- Uniapp display rich text effect demo (organize)
- Redis-事务与乐观锁
- 为华为打造无美系设备的产线,台积电三星能做到吗?
- Sign up now | cloud native technology exchange meetup Guangzhou station has been opened, and I will meet you on August 6!
猜你喜欢

From the second floor to the third floor
![[BuildRelease Management]Parabuild](/img/80/11c2b539c217ecd6ba55668d3e71e9.png)
[BuildRelease Management]Parabuild

Code review tool

一文读懂CMake

The most detailed summary of common English terms in the chip industry (quick grasp of graphics and text)

How does JMeter solve the problem of garbled code?

数组相关知识

Array related knowledge

芯片行业常用英文术语最详细总结(图文快速掌握)

数据可视化-《白蛇2:青蛇劫起》(3)
随机推荐
Branch and loop sentence exercises
【OpenCV 例程 300篇】241. 尺度不变特征变换(SIFT)
At least 42 employees are infected with novel coronavirus! Nokia announces closure of telecom equipment plant in India
小波变换学习笔记
网络设备硬核技术内幕 防火墙与安全网关篇 (十一) 零接触办公的奥秘 上
Interesting Huffman tree
How does JMeter solve the problem of garbled code?
进程与进程调度
Network equipment hard core technology insider firewall and security gateway (12) the mystery of zero contact office
The Canadian court found Meng Wanzhou guilty of "dual criminality", and the extradition procedure will continue!
[CruiseControl]Build Result JSP
Jerry Zhi doesn't play hidden audio files [article]
单片机之led、数码管与按键
[CruiseControl]Build Result JSP
[meetup preview] openmldb + ONEFLOW: link feature engineering to model training to accelerate machine learning model development
scrollview、tableView嵌套解决方案
DC motor winding parameters
One year anniversary of creation, Chongba young Lang
Operators in MySQL
Postman download and use tutorial