Run actions sequentially in scenario

Hello,

I’m trying to execute this scenario

val scn = scenario(“SimulationOne”)
.exec(allFiltering.filtering)
.exec(CheckQualitiesClass.checkQuality)
.exec(allFiltering.finishTaskAfterQualityCheck)

but the problem is that the last action depends on a file created in the first one. The way it runs now is that it doesn’t wait for the first one to finish before starting the next action which is what I want to achieve.

Can anyone help?

Thanks.

Hi,

try passing lambdas to defer their execution in the scenario flow, i.e.:

`
exec(session => allFiltering.filtering)

`

But remember – the called function should return session object.

Cheers,
Adam

you can group them.

The .exec requests in a scenario do run one after the other, once the response for the earlier request has arrived.
So, if you have a problem with the last action, see if the valid response from first request actually means the file has been created or it just puts on some queue to be processed asynchronously.
Also you could try adding pauses between the requests.

When I split the steps into two simulations and run them back to back, they work. I wanted something to do that in one simulation so I would have both steps in the Gatling report

Thanks for the reply but it didn’t work. Still searched for the file prematurely.

Hi,

this gives me the error of

found : io.gatling.core.structure.ChainBuilder
required: io.gatling.commons.validation.Validation[io.gatling.core.session.Session]

so maybe I didn’t succeed in returning the session object :slight_smile: