Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A Quick start to the Open Source performance testing tool JMeter (1)

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Catalogue

A brief introduction to JMeter

II. Introduction of JMeter function

III. JMeter script

4. Tips on JMeter

A brief introduction to JMeter

1. Define

JMeter is a Java-based stress testing tool developed by Apache. Used for stress testing of software, it was originally designed for Web application testing, but later extended to other testing areas.

1) it can be used to test static and dynamic resources, such as static files, Java applets, CGI scripts, Java objects, DB, FTP servers, and so on.

2) JMeter can be used to simulate huge loads on servers, networks, or objects, testing their strength and analyzing overall performance from different stress categories.

3) JMeter can do functional / regression tests on the application and verify that the program returns the expected results by creating a script with assertions. For maximum flexibility, JMeter allows you to create assertions using regular expressions.

4) JMeter supports Web (Http, Https), SOAP, FTPd, JDBC, mail, MongoDB, TCP, native commands or Shell scripts

Advantages of 2.JMeter

1) any DB can be stress tested (via JDBC)

2) Pure Java with strong portability

3) lightweight component support package (precompiled JAR uses javax.swing.*)

4) Multithreading (simultaneous operation of different functions by multiple threads or through separate thread groups)

5) accurate timing

6) caching and offline analysis, playback of test results

7) completely open source, you can redevelop JMeter and add plug-ins for business correspondence.

Insufficient 3.JMeter

1) the recording feature is not convenient to operate. Need a third-party tool Badboy or use a Browser agent to record

2) it is difficult to get started and there are few online learning resources.

3) the report type is less, and the scene design is more complex than LR.

4) process mode is not supported

5) the result of large concurrency is not accurate.

II. Introduction of JMeter function

1. Test plan

When JMeter is started, a test plan is opened by default, and a complete test plan includes one or more thread groups, logic controls, sampling generation controls, listeners, timers, assertions, and configuration elements.

two。 Thread

Equivalent to VUser in LR, the first step in each JMeter test plan is to add thread groups. Set the number of concurrent users, concurrent time or concurrent times, and thread startup frequency in the thread group.

There are three types of thread groups for JMeter:

Setup thread group: setup, pre-test preparation initialization, namely init

Teardown thread group:teardown, garbage collection and other clean-up work after testing, namely end

Thread group: the most commonly used thread group, equivalent to Action. A thread is the equivalent of a Vuser in a LR, and these threads cannot be changed while the script is running.

3. Test fragment (Test Fragment)

The test fragment element is like a special thread group on the controller, at the same level as the thread group on the test tree. But it is not executed unless referenced.

4. Sampler Sampler

The minimum unit in a performance test that sends a request to the server and waits for a response time, and each sampler has different properties to edit.

5. Logic controller

The behavior logic of sending requests by JMeter can be customized, and the complex request sequence can be simulated in combination with Sampler. Commonly used logic controllers are: IF Controller, While Controller, Runtime Controller, transaction controller, random controller, alternating controller, throughput controller, module controller and so on.

6. Listener

Collect and process the JMeter test results and visualize a series of components, including request data sent, result data returned, response time statistics, throughput, error rate, return result status and so on. Common listeners are: graphical results, view the result tree, view the results with tables, aggregate reports, and so on.

7. Configuration component

Maintain the configuration information needed by Sampler and modify the request content according to the actual needs. The general configuration element is placed before the request begins.

8. Timer

That is, thinking time. On the one hand, in order to truly simulate the concurrent behavior of users, and second, to control the request interval between each thread to reduce the pressure on the server.

9. Assertion

That is, checkpoints. Stress testing is based on the premise that the function is correct. Commonly used assertions are: response assertion, XML assertion, HTML assertion, XPath assertion.

10. Front processor

Used to modify the requested settings. The eg.Http URL rewrite fix can implement URL rewriting. When there is session information such as sessionID in the RUL, the processor can be used to populate the actual sessionID that made the request.

11. Post processor

That is, connection. It is used to process the server response data obtained from the request made by Sampler. It is generally used to extract specific data in the response, such as using the regular expression extractor in the post processor to correlate the specific data returned by the server.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report