Load test only the second API , after getting data from first API

I have a similar case to this.
I need to get data from first API and pass that data to second API. I have created scenario with chaining these 2 api’s. When I executed simulation , both the API’s gets executed N number of times.

Instead I want to execute the first API only once and get the data and load test only the second API. How can I achieve this

Hi @partheeban,

If I understand correctly your requirements, you want to fetch the initial data once then use that with several virtual users.

If fetching the initial data is fast enough, you may want to use a classic client during the Simulation initialization phase to fetch the data.

Otherwise, you may use a global variable, a first scenario (with only one user) will fetch the data and store id in the global variable andThen the second scenario will get this global variable to compute the data for the real load test.

Does that help?

Cheers!

Thank you very much. I am able to implement this.

You can look in solution in below topic, there you have this kind of request what you need.
https://community.gatling.io/t/token-refresh-java-example/7935

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.