Skip to content

Instantly share code, notes, and snippets.

@fragaLY
Created January 20, 2023 13:15
Show Gist options
  • Save fragaLY/6cec74fd438f3b7525e8ae53dfd1982c to your computer and use it in GitHub Desktop.
Save fragaLY/6cec74fd438f3b7525e8ae53dfd1982c to your computer and use it in GitHub Desktop.
Gatling with custom ids
public class A2BSimulation extends Simulation {
private static final Iterator<Map<String, Object>> FEEDER = CoreDsl.csv("/Users/Vadzim_Kavalkou/Desktop/ids.csv").readRecords().iterator();
final HttpProtocolBuilder protocol = http
.warmUp("https://www.google.com")
.baseUrl("http://localhost:8080/api/v1")
.acceptLanguageHeader("en-US,en;q=0.5")
.acceptEncodingHeader("gzip, deflate")
.userAgentHeader(
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36");
final ScenarioBuilder scenario = scenario("Location Service Simulation")
.feed(FEEDER)
.exec(http("[GET] The employee location.")
.get("/locations")
.queryParam("id", "${id}")
.check(status().is(HttpResponseStatus.OK.code()))
.check(header("location").exists())
)
.pause(1, 5);
{
setUp(scenario.injectOpen(
rampUsersPerSec(100).to(200).during(Duration.ofSeconds(1000)).randomized())
.protocols(protocol)).maxDuration(Duration.ofSeconds(2000));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment