Performance testing tool: Jmeter introduction

JMeter is an open source Java application developed and maintained by the Apache Software Foundation, which can be used for performance testing, stress testing, interface testing, etc.

1. Principle

The basic principle of JMeter is to simulate multiple users concurrently accessing the application, by sending HTTP requests or other protocol requests, and measuring the response time, throughput, number of concurrent users, error rate and performance indicators, etc., to evaluate the performance and stability of the application .

2. JMeter Features

1) Support multiple protocols

It supports protocols such as HTTP, HTTPS, FTP, TCP, JDBC, and JMS, and can simulate various network environments and application scenarios.

2) Support multiple test types

Support load test, stress test, functional test, benchmark test and distributed test and other test types, suitable for different performance test requirements.

3) Support multiple test scenarios

Support a variety of test scenarios, including the number of concurrent users, duration, cycle times and delay time, etc., which can simulate real usage scenarios.

4) Support multiple test result collection and display methods

Supports a variety of test result collection and display methods, including aggregated reports, graphical results, tree results, and console output, to facilitate performance analysis and optimization.

5) Support plug-ins and extensions

JMeter supports plug-ins and extensions that can extend its functionality and performance to meet specific performance testing needs.

2. Components of JMeter

1) Test Plan (Test Plan)

A test plan is the highest level in JMeter and includes multiple thread groups, configuration elements, and listeners. The test plan is used to set global test parameters, including test name, working directory, number of threads and duration, etc.

2) Thread Group (Thread Group)

Thread group is used in JMeter to simulate concurrent user access to application components, including a set of threads (users) and a set of controllers (logic control). The thread group is used to set parameters such as the number of threads, the number of cycles, duration, and delay, and the controller is used to set the logic control of the thread (user) request and response.

3) HTTP request (HTTP Request)

HTTP request is a component in JMeter that simulates a client sending an HTTP request to the server. HTTP requests include the requested URL, protocol, method, parameters, header, and Body, etc., and can simulate HTTP request methods such as GET, POST, PUT, and DELETE to test the response speed and performance of the application. In HTTP requests, you can set request parameters, response assertions and listeners, etc. to collect and display test results.

4) Controller (Controller)

Used to control the execution flow of test plans and thread groups, including simple controllers, random controllers, loop controllers, and conditional controllers.

5) Listener (Listener)

Listeners are components in JMeter that collect and display test results, including aggregated report listeners, graphical result listeners, tree result listeners, and console output listeners. Listeners are used to monitor test results to assess application performance and stability and generate reports.

6) Assertion

Assertions are components in JMeter that verify the status code, content, and format of HTTP responses, including response code assertions, response content assertions, and response time assertions. Assertions are used to verify the correctness and integrity of HTTP responses to ensure application functionality and performance.

7) Config Element

Properties and parameters for configuring test plans and thread groups, including HTTP request defaults, CSV data file configuration, user-defined variables, and more.

8) Starter (Timer)

It is used to wait for a period of time before sending an HTTP request or before a thread starts to simulate user behavior. The launcher is used to set the waiting time before execution of the thread group to simulate real usage scenarios.

9) Pre-processor (Pre-Processor)

It is used for processing before sending HTTP requests, including user parameters, CSV data sets, HTTP cookies, etc.

10) Post-processor (Post-Processor)

Used for processing after receiving HTTP responses, including regular expression extractors and XPath extractors, etc.

3. JMeter User Interface

JMeter's user interface consists of the following main parts:

1) Toolbar: Contains commonly used function buttons, such as start, stop, save and import, etc. For example, we can use the buttons on the toolbar to start and stop the test in order to conduct the test and observe the test results.

2) Tree structure: used to organize various components of the test plan, including test plans, thread groups, controllers, listeners, and configuration elements.

3) Properties window/panel: used to display and edit the properties of the selected component, such as number of threads, delay and protocol, etc.

 

4. JMeter configuration file

JMeter's configuration files are used to store various configuration options and global variables, including the following main files:

1) jmeter.properties: Contains JMeter's global configuration options, such as default encoding, connection timeout and proxy server, etc.

2) user.properties: Contains user-defined global variables and configuration options, such as user-defined variables and custom plug-ins.

3) saveservice.properties: JMeter result saving configuration file, including configuration parameters such as the saving format, encoding, compression, and delimiter of JMeter test results.

If the article is helpful to you, remember to like, bookmark, and add attention. I will share some dry goods from time to time...

END Supporting Learning Resources Sharing

Finally:  In order to give back to the die-hard fans, I have compiled a complete software testing video learning tutorial for you. If you need it, you can get it for free 【保证100%免费】

加入我的软件测试交流qq群:110685036免费获取~(同行大佬一起学术交流,每晚都有大佬直播分享技术知识点)

Software Testing Interview Documentation

We must study to find a high-paying job. The following interview questions are the latest interview materials from first-tier Internet companies such as Ali, Tencent, and Byte, and some Byte bosses have given authoritative answers. Finish this set The interview materials believe that everyone can find a satisfactory job.

è¿éæå¥å¾çæè¿°

How to obtain the full set of information:

è¿éæå¥å¾çæè¿°

Guess you like

Origin blog.csdn.net/IT_LanTian/article/details/131306394