It seems my scenarios are not abiding by the order I would expect.
Top level scenario is this
setUp(TestEnvironment.initializeForTest()
.andThen(scenario1("PostOrderJMSMessages-1").injectOpen(atOnceUsers(1)))
.andThen(TestEnvironment.checkJmsPerformanceStats())
)
.assertions(...)
I want to use a scenario for test initialization so I can use Gatling plumbing and bail if the environment is not ready
So the first call is to this fn()
public static PopulationBuilder initializeForTest() {
return scenario("Setup")
.exec(s -> {
LOGGER.info("Setting up test environment");
return s;
})
.exec(validateJMSConnections())
.pause(Duration.ofMillis(200))
.exec(resetActiveMQCounters())
.pause(Duration.ofMillis(200))
.exec(validateJMSCounterReset())
.exitHereIfFailed()
.injectOpen(atOnceUsers(1));
}
The scenario fires a sequence of JMS messages with 5 sec intervals between them for about 30 sec total
Verification is at the end is…
public static PopulationBuilder checkJmsPerformanceStats() {
return scenario("Check Stats")
.exec(checkQueueStats())
.injectOpen(atOnceUsers(1));
}
I log messages during the scenarios to figure out what was going on, it’s clear that the last step is firing early when no messages have been sent.
15:14:06.137 gatling-1-2 [INFO ] l.TestEnvironment - Setting up test environment
15:14:06.680 gatling-1-2 [INFO ] l.TestEnvironment - Checking that Counters are reset
15:14:07.158 gatling-1-4 [INFO ] l.TestEnvironment - Verify JMS Performance
================================================================================
2024-01-29 15:14:11 5s elapsed
---- Requests ------------------------------------------------------------------
> Global (OK=3 KO=1 )
> Validate Connections (OK=1 KO=0 )
> Check that JMS Counters are reset (OK=1 KO=0 )
**> Verify JMS Performance (OK=0 KO=1 )**
> Send OrderAccepted to STORE.ORDER-STATUS.FS (OK=1 KO=0 )
Any idea what I might be doing wrong ?