当前位置:网站首页>Simple use of JMeter

Simple use of JMeter

2020-11-09 23:48:00 yellowgg

One 、 First time to know JMeter

1. brief introduction ( From baidu baike )

Apache JMeter yes Apache Organization development based on Java Pressure testing tools for . For stress testing software , It was originally designed for Web Application testing , But then it expanded to other areas of testing . It can be used to test static and dynamic resources , For example, static files 、Java Applet service 、CGI Script 、Java object 、 database 、FTP The server , wait .JMeter Can be used for server 、 Network or object simulating huge load , Test their strength and analyze their overall performance from different stress categories . in addition ,JMeter Ability to function on Applications / regression testing , Verify that your program returns what you expect by creating a script with assertions . For maximum flexibility ,JMeter Allow regular expressions to create assertions .

2. Self description

JMeter Is the industry's better test software , The most basic function can be regarded as postman Use , Then the advanced point is to do concurrent testing for the interface , Concurrency here refers to the real meaning of concurrency , image postman The so-called concurrency of software like this is essentially serial execution . The higher-level usage is to complete the pressure test of multiple servers through the script , Because understanding is limited , More advanced usages need to be used in practice to have the chance to learn .

Two 、 Download and install JMeter

The environment is Win10,jdk edition 1.8 above

1. download

Official website download address

2. install

Directly decompress the downloaded compressed package to the location where you want to install it . Unzip to use ( The premise is that the system has been configured jdk Environmental Science )

3. Catalog

Decompress to see JMeter The basic contents of , We can roughly understand .

4. plug-in unit

JMeter Support for plug-in extensions , There are more functions that can be implemented with plug-ins .

There are two ways to use plug-ins ,

​ One is to download the corresponding plug-in jar Put the bag in %jmeter%\lib\ext Under the path .

​ The second is to use the plug-in manager provided by the official website , Then select the required plug-in in manager to install it .

Here's the second method , Download the plug-in manager first jmeter-plugins, Then download the good ones jmeter-plugins-manager-1.4.jar Put it in %jmeter%\lib\ext You can restart it .

open JMeter after , stay GUI Interface selection Options -> Bottom Plugins Manager You can open the plug-in manager to use .

3、 ... and 、 Basic use

In this brief introduction JMeter Running background of , Use GUI Interface execution testing consumes a lot of system resources , Using command-line tools to execute test scripts can reduce the required system resources , So the general usage is first in GUI The interface creates the script of the test plan , And then through the command line to execute .

1. function

open %jmeter%\bin Folder , There are sh and bat Two formats of script , They correspond to each other Linux Systems and Win Systematic . open jmeter.bat A command window and GUI Interface window , The two coexist , Can not close , When using, minimize the command window .

Command window :

GUI Interface window :

2. Language switching

English is convenient to use in comparison with official documents , But it's OK to switch to Chinese , In the previous version of Chinese, you need to download the language pack and load it manually , There is no need for this version , Directly in GUI Interface window operation Options -> Choose Language -> Chinese (Simplified) that will do

Then I switched to Chinese .

3. Component is introduced

The components described below are used according to the components learned by individuals , So use it as a developer JMeter Maybe not as good as professional use , Just for introduction .

3.1 test plan (Test Plan)

It can be understood as a project , It's the largest root directory , It includes a variety of real working test components .

3.2 Thread group (Thread Group)

add to : Threads ( user ) -> Thread group

Also known as user groups , It's the basic unit for testing , It can also be understood as the starting point of test plan execution , It can set thread information to simulate concurrency .

3.3 Counter (Counter)

add to : The configuration element -> Counter

The original used to configure some counting functions , For example, I test the interface , Need to pass a ID,ID Each increment 1, Once you set it up , Use... Directly in the request parameters ${ Quote name } You can use .

3.4 Aggregation report (Aggregate Report)

add to : Monitor -> Aggregation report

Generally used to show Web Interface testing , All the data in it reflect the situation of the interface .

The meaning of each data is ( Be careful : The unit of time is ms):

Label: The name of each request , It can be understood as the request of each interface Name attribute .

sample (Samples): Indicates the total number of requests initiated in a test , If you follow the above set continuous 30s, Per second 100 Concurrency , So that is 30*100=3000 A request .

Average (Average): Mean response time , The default is the average response time for a single request .

Median (Median): Median , That's half of the user's response time .

90% Percentile sum 95% Percentile (90% Line and 95% Line): Signification 90% and 95% The response time of the user , As to why these two percentages of users are, you can find out for yourself .

minimum value (Min): Minimum response time .

Maximum (Max): Maximum response time .

abnormal %(Error%): Error rate , A request with an error in a test / Total number of requests .

throughput (Throughput): The default is the number of requests completed per second .

3.5 Response time graph (Response Time Graph)

add to : Monitor -> Response time graph

It's not a mistake to take the picture with you , But it doesn't seem to work very well , So in fact, the graphs generated by other plug-ins are more dynamic .

3.6 Look at the fruit tree (View Results Tree)

add to : Monitor -> Look at the fruit tree

I don't know if it's because of translation problems , Maybe it's written to look at , In short, it means . This component can see the sending and returning information of the request , When you run the test , This will automatically fill in the request data, and you can see .

3.7 Http request (Http Request)

add to : Sampler -> Http request

Here are the most commonly used components , Analog interface test request , Fill in the server IP Address and port number , Then fill in the request path , Set the input parameters , You can use it .

3.8 TPS

add to : Monitor -> jp@gc - Transactions per Second

Want to see TPS You have to install the plug-in first , Plug in manager can be used to install .

Then when you add the component , choice TPS that will do ,


These components also wait for the test to complete and have data before drawing the chart , Nothing will happen until the test is executed .

ps: This article introduces some simple components used by individuals , There are still a lot of good things that I haven't touched yet , You can continue to learn to use .

Four 、 Summary

I learned from this study that JMeter A quick start to , Including download and install 、 Some simple uses . In fact, it may not even be regarded as an introduction ,JMeter It's still complicated , Like how it works 、 The configuration file 、 Log management 、 Timer 、 Assertion 、 More advanced functions such as command line execution , I hope to learn more about , Master more skills .

The article is on my computer typora Write the transplanted , Because of the board problem , It's awkward to wrap the content .
And some of them can't be reproduced , You can only use the local screenshot above , So it's fuzzy .

版权声明
本文为[yellowgg]所创,转载请带上原文链接,感谢