Stress Test Load Test Http RESTful
▌Introduction
SuperBenchmarker provides a convenient
way to make different Url or payload.
▋Related articles
▌Implement
For
example, we have an HttpPost API like this:
http://localhost:5000/seminar/signin/<my-token>
and
Its payload is as following JSON,
{
"id": "JB",
"pwd": "1234"
}
▋Mocked dataset
Lets
create a CSV file to store the
·
Token (For url)
·
Id (For payload)
·
Pwd (For payload)
▋SignIn_data.csv
token,id,pwd
AAAAA,JB1,1234
BBBBB,JB2,2345
CCCCC,JB3,3456
DDDDD,JB4,4567
EEEEE,JB5,5678
▋Http Raw file
Replace
the Http Raw with {{{}}}
to indicate that it will be replaced by the content from Dataset (SignIn_data.csv).
▋SignIn_data.csv
Content-Type: application/json
{"Id":"{{{id}}}", "Pwd":"{{{pwd}}}"}
▋Start testing the API
sb -u
"http://localhost:5000/seminar/signin/{{{token}}}"
-n 5 -c 2 -m POST -f
D:\Temp\SignIn_data.csv -t
D:\Temp\HttpRaw_SignIn.txt
|
-u
|
Request URL
|
-n
|
How many requests you want to send.
|
-c
|
The number of concurrent requests for each
boost.
|
-m
|
Http method type
|
-f
|
The path of mocked dataset
|
-t
|
Optional, if you have to add something to the
header and message of Http request, then you have to put the complete http
raw in a file.
|
Result:
What the API gets,
▌Reference
l https://github.com/aliostad/SuperBenchmarker
沒有留言:
張貼留言