Hello all,
Is there any possibility to retrieve the Simulation StatusCode and assert it from outside, e.g., with Junit?
I’m using this method from class Gatling to start the Simulations:
// used by maven archetype
def fromMap(overrides: ConfigOverrides): Int = start(overrides, None)
And in start() the StatusCode is computed and asserted. But all methods aside from fromMap() and main() are private.
Maybe there is a way to listen to the Simulation execution status?
Sorry but no.
The fact that those methods are private is intended: they are not a public API.
I found kind of a solution in the docs: one can retrieve it from a scenario with help of the session API.
public class SimulationTest extends Simulation {
public static boolean successful = true;
ScenarioBuilder scn = scenario("foo")
.exec(http("bar")
.get("https://gatling.io/")
.check(status().is(200)))
.exec(session -> {
if (session.isFailed())
successful = false;
return session;
});
//...
}