Nguyen Sy Thanh Son
Nguyen Sy Thanh Son

Reputation: 5376

How to implement stress test with NodeJS LoadTest

I need to stress test a link that works with curl command below:

curl "http://192.168.1.191:7007/api/v1/users/login" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: en-US,en;q=0.8,vi;q=0.6" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36" -H "Content-Type: application/x-www-form-urlencoded" -H "Accept: application/json" -H "Connection: keep-alive" --data "username=test&password=test" --compressed

How can I implement stress test with LoadTest

Upvotes: 1

Views: 1054

Answers (1)

Nguyen Sy Thanh Son
Nguyen Sy Thanh Son

Reputation: 5376

I found the solution.

I created a file test.txt with content:

username=test&password=test&

After that, run test command:

loadtest "http://192.168.1.191:7007/api/v1/users/login" -n 1000 -c 5 -p test.txt -T 'application/x-www-form-urlencoded'

Please make note that you have to add '&' in the end of test.txt file. This is a issue of LoadTest. I have had a pull request to fix it at https://github.com/alexfernandez/loadtest/pull/63

Upvotes: 1

Related Questions