Skip to content

Instantly share code, notes, and snippets.

@slawekradzyminski
Created January 21, 2023 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slawekradzyminski/804b0eda7a031e1e0e15eaeee4cb170c to your computer and use it in GitHub Desktop.
Save slawekradzyminski/804b0eda7a031e1e0e15eaeee4cb170c to your computer and use it in GitHub Desktop.
import io.gatling.core.Predef;
import io.gatling.core.scenario.Simulation;
import io.gatling.core.structure.ScenarioBuilder;
import io.gatling.http.Predef;
import io.gatling.http.protocol.HttpProtocolBuilder;
public class SimpleLoadTest extends Simulation {
HttpProtocolBuilder httpConf = Predef.http().baseUrl("http://localhost:8080")
.acceptHeader("application/json");
ScenarioBuilder scn = Predef.scenario("Simple Load Test")
.exec(Predef.http("request_1")
.get("/api/endpoint")
.check(Predef.status().is(200))
.check(Predef.jsonPath("$.key").is("value"))
);
{
Predef.setUp(
scn.inject(Predef.constantUsersPerSec(10).during(10))
.protocols(httpConf)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment