jmeter

Using JMeter for Parallel API Testing with Varying Request Rates


I am working on a project and one of the things I have to do is to test the API.

So they give me 5 different Endpoints to test. Each one has its own request per seconds which has to be sent.

Example:

/endpoint1 has to be tested for one minute

and the amount of requests has to be 250 in total.

It will be separated throughout the one minute randomly.

/endpoint2 has to be tested for one minute

and the amount of requests has to be 159 in total.

It will be separated throughout the one minute randomly. Etc.

At the end I have to end up with a graph showing each of those requests and how they preformed.

All of that requests have to run in parallel.

I am using now JMeter and don`t know how to get that constant time to work and how i even can make all those request and tests run parallel.

I tried using the parallel plugin but did not work.

Can i do all of that in JMeter?


Solution

  • Yes, you can do that with JMeter.

    What I suggest, is to use 2 different Open Model Thread Groups, each with one child Sampler underneath them (HTTP Request Sampler in your case, but can be any type of sampler, it should work the same - I used the Dummy sampler just for testing out the scenario you mentioned). Configure them as such:

    Open Model Thread group 1 Schedule setup: rate(250/min) random_arrivals(1 min)

    Open Model Thread group 2 Schedule setup: rate(159/min) random_arrivals(1 min)

    enter image description here

    This setup should ensure that the target defined rate of Sampler executions is achieved within 1 minute and the 2 samplers will execute concurrently, which is what I suppose you meant by "All of that requests have to run in parallel".

    Note: make sure that the checkbox Run Thread Groups consecutively (i.e. run groups one at a time) is unchecked at the level of the JMeter Test Plan.

    Then you can run the test and use JMeter Listeners to check the results.

    enter image description here

    enter image description here

    Once you are happy with the outcome, you can run the test in CLI mode, generate a .jtl results file and build the JMeter Dashboard Report based on it.