Running an arbitrary number of requests sequentially (3.7.6)

Hi all!

I’m using Gatling as a integration tool in a small Java program. The program take an arbitrary number of files where the request and checks are defined, it creates the appropriate scenarios and groups them in a single PopulationBuilder class.
Everything works fine, but every request is done at once, and I really need to make each request sequentially.

There is ChainBuilder:

ChainBuilder request1 = request1.exec(...);
ChainBuilder request2 = request2.exec(...);
ScenarioBuilder scn = scenario("myscenario").exec(request1, request2);

And .andThen():


However, I couldn’t get the desired effect. It seems the andThen threats every first ocurrence as the parent and the others as children at the same hierarchy level. The ChainBuilder I don’t know how I can put hundreds of scenarios there.
With a small number of requests it can work fine, but I need to work with several thousands. I’m using as a single setUp because it generates the aggregated report of all requests that is quite useful.

Anyone had a similar implementation or has a an idea how to put this together?

Gatling is not meant for putting hundreds of scenarios together. You should only have a few. No idea what you’re doing but you should try to merge most of your scenarios together.

Thanks for your response.

Hi… you can try using Seq() like below if you have few scenarios to execute sequentially:

scenario(“Single scenario for sequential execution of APIs”)

In above code block, testScenario2 will be executed after testScenario1.