I'm using the following feeder that generates two random UUIDs
Iterator<Map<String, Object>> postRequestDataFeeder =
Stream.generate((Supplier<Map<String, Object>>) () -> {
String id = java.util.UUID.randomUUID().toString();
String version = java.util.UUID.randomUUID().toString();
return Map.of("id", id, "version", version);
}
).iterator();
And I will be reusing the feeder in 5-6 scenarios, following is a sample scenario
public static ScenarioBuilder dataCreationForPostRequest =
scenario("Data creation for post request")
.feed(postRequestDataFeeder)
.exec(//)
.exec(session -> {
// save generated data to a list
return session;
})
The Gatling documentation says
Every time a virtual user reaches this step, it will pop a record out of the Feeder, which will be injected into the user’s session, resulting in a new Session instance.
But when I run the simulation it will crash saying that the Feeder is empty
How can the feeder be empty if it will pop a record every time a virtual user reaches this step? Is is not possible to reuse feeders throughout multiple scenarios?
That's indeed a bug in Gatling's Java DSL. It will be fixed in Gatling 3.8.0.