diff --git a/src/test/java/com/github/jaguililla/appointments/GatlingSimulation.java b/src/test/java/com/github/jaguililla/appointments/GatlingSimulation.java index 8145e78..2f40885 100644 --- a/src/test/java/com/github/jaguililla/appointments/GatlingSimulation.java +++ b/src/test/java/com/github/jaguililla/appointments/GatlingSimulation.java @@ -4,13 +4,10 @@ import static io.gatling.javaapi.http.HttpDsl.*; import io.gatling.javaapi.core.*; -import io.gatling.javaapi.http.*; public class GatlingSimulation extends Simulation { - String baseUrl = "http://localhost:18080"; - - ChainBuilder appointmentsCrud = exec( + private ChainBuilder appointmentsCrud = exec( http("Create").post("/appointments").check(status().is(201)), pause(1), http("Read").get("/appointments").check(status().is(200)), @@ -19,10 +16,11 @@ public class GatlingSimulation extends Simulation { pause(1) ); - HttpProtocolBuilder httpProtocol = http.baseUrl(baseUrl); - ScenarioBuilder users = scenario("Appointments").exec(appointmentsCrud); - { + var baseUrl = "http://localhost:18080"; + var httpProtocol = http.baseUrl(baseUrl); + var users = scenario("Appointments").exec(appointmentsCrud); + setUp(users.injectOpen(rampUsers(10).during(10))).protocols(httpProtocol); } }