Home > Blockchain >  How to appropriately test a full REST API with JMeter
How to appropriately test a full REST API with JMeter

Time:11-25

I'm currently trying to load test a REST API with JMeter for the first time. I have followed some tutorials and think I understand the basics of how JMeter works.

Now I want to know what's the best way to load test the API. Should I load test one http request at a time (alone or with other http requests tests in the background). Or should I load test all of the http requests of the API.

I would also love to get other suggestions for load testing REST APIs, that would be very much helpful.

CodePudding user response:

It depends on the product and the type of test you're conducting.

Normally you should have a vision of how the API will be used by real users (or other applications). Your test should mimic the anticipated usage as close as possible, ideally with 100% accuracy.

  1. If the API is a standalone product like weather API or something like this I would first test each endpoint individually followed by the integration test when all endpoints will be accessed concurrently with real-life distributions (i.e. the number of requests for weather in London will be much higher than the number of requests for weather in Sahara)
  2. If the API is being used by the application frontend via AJAX requests you should call the endpoints in the same manner as real browser does, in this case you will need to use solution like Parallel Controller)

With regards to "other suggestions" they're quite simple:

  • If you have NFR or SLA - run a load test and check whether the KPIs match these NFR or SLA
  • If you don't have and you need to find the first bottleneck - run a stress test (start with 1 user and gradually increase the load until you reach the saturation point or errors start occurring, whatever comes the first)
  • Related