-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCase0025JSONfeederRandomSimulation.java
42 lines (35 loc) · 1.69 KB
/
Case0025JSONfeederRandomSimulation.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package pl.gemiusz;
import io.gatling.javaapi.core.FeederBuilder;
import io.gatling.javaapi.core.ScenarioBuilder;
import io.gatling.javaapi.core.Simulation;
import io.gatling.javaapi.http.HttpProtocolBuilder;
import static io.gatling.javaapi.core.CoreDsl.*;
import static io.gatling.javaapi.http.HttpDsl.http;
public class Case0025JSONfeederRandomSimulation extends Simulation {
HttpProtocolBuilder httpProtocol =
http
.baseUrl("https://postman-echo.com");
FeederBuilder<Object> feederJSON = jsonFile("feeders\\dzejson.json").random();
ScenarioBuilder scn =
scenario("GeMi_JSONfeederRandomSimulation")
.feed(feederJSON)
.exec(
http("GeMi_JSONfeederRandomSimulation_get_username")
.get("/get?foo=#{username}")
.check(jmesPath("args.foo").saveAs("usernameRsp"))
).exec(session -> {
System.out.println("GeMi_usernameRsp: " + session.get("usernameRsp"));
return session;
})
.exec(
http("GeMi_JSONfeederRandomSimulation_get_random_patientID")
.get("/get?foo=#{patients.random().patientID}")
.check(jmesPath("args.foo").saveAs("patientIdRsp"))
).exec(session -> {
System.out.println("GeMi_patientIdRsp: " + session.get("patientIdRsp"));
return session;
});
{
setUp(scn.injectOpen(atOnceUsers(1)).protocols(httpProtocol));
}
}