Apache JMeter: The Complete Guide

Apache JMeter is an open source performance testing tool that can be used to test various types of servers such as Web applications, FTP servers, and databases. This article will use JMeter 5.5 as an example to introduce the use of JMeter .

Download and install

Since JMeter is developed in Java, the JDK must be installed before running. You can download JMeter in this JMeter download and installation tutorial .

 

JMeter is an installation-free software. You can use it by directly decompressing the installation package after downloading it. In the bin directory, Windows users can run the jmeter.bat file to start JMeter, while Unix/Mac OS X users need to run jmeter/jmeter.sh.

 

Create test plan

In JMeter, test cases are organized into "test plans". To create a new test plan, select File > New > Test Plan.

 

Add thread group

Thread groups are the basic element of a test plan, defining the number and duration of concurrent user access to be simulated. To add a thread group, right-click the test plan and select Add > Threads (Users) > Thread Group.

 

Configure thread group parameters

  • Number of Threads (users): Number of threads. 100 threads simulate 100 users.
  • Ramp-Up Period (in seconds): Thread preparation time. If the number of threads is 100 and the preparation time is 10, then it takes 1 second to start 10 threads.
  • Loop Count: Number of loops. If the number of threads is 100 and the number of loops is 10, then each thread sends 10 requests. The total number of requests is 100*10 = 1000. If "Infinite" is checked, all threads will continue to send requests until manually stopped.

 

Add HTTP request

Add an HTTP request to the thread group to simulate user access to the Web application. To add an HTTP request, right-click the thread group and select Add > Sampler > HTTP Request.

 

Configure HTTP request parameters

In the HTTP request, you need to configure parameters such as the server's host name, port, protocol, and path. You can also add various types of parameters to the request, such as GET/POST parameters, HTTP headers, and cookies. Here we take the sample site www.example.com/ as an example.

 

Add listener

Listeners are used to collect and display test results. To add a listener, right-click the thread group and select Add > Listener. There are many optional listeners, here we take "View Results Tree" as an example.

 

Run tests

When you have your test plan ready, you can click the Run button in the toolbar to run the test. The test results will be displayed in the listener.

 

Summarize

Apache JMeter is a powerful performance testing tool that can help you test various types of servers. The above steps provide a basic JMeter testing workflow. You can further customize and optimize it according to your needs.


How to obtain information

【Message 777】

Friends who want to get the source code and other tutorial materials, please like + comment + collect , three times in a row!

After three consecutive rounds , I will send you private messages one by one in the comment area~

Guess you like

Origin blog.csdn.net/GDYY3721/article/details/132259692