This article describes several keypoint elements to test your RESTful APIs. To begin with, you should make sure you have installed the following softwares or SDK:
Author: @LucasXU
- Enter
bin
directory and runjmeter.bat
(on Windows) orjmeter.sh
(on Linux), you will see GUI of JMeter as follows:
- Right-click
testplan
, chooseAdd-Threads(Users)-Thread Group
- Modify the default settings:
There are mainly3
key params:
Number of Threads (users)
meanshow many QPS you will create to hit your API
, since JMeter utilizeThread
to mock user visitRamp-Up Period (in seconds)
means how long your threads will be executed done. Take the following image setting as an example, it denotes that800 threads
will be executed done within10 seconds
. Namely, the average QPS is about80/s
.Loop Count
means the loop times will the thread group will be executed
- Right-click
Thread Group
, chooseAdd-Sampler-HTTP Request
- Modify the default settings, such as
protocol
,server/IP
,port number
,send params
, and etc.
-
Click
Start
button, it will start sending HTTP requests to your API -
Right-click
Add-Listener-Summary Report/View Results Tree
to view execution details
- As mentioned by JMeter terminal--
Don't use GUI mode for load testing !, only for Test creation and Test debugging
. You should save yourTestPlan.jmx
file, and execute test plan with command line:
./jmeter.sh -n -t ./testplan/YOUR_TEST_PLAN.jmx -l testplan/result/result.txt -e -o testplan/webreport
It will generate results file
and web report
, just open the index.html
with your browser, you will see: