-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathCase0003UnzipJsonForFeederSimulation.java
More file actions
46 lines (39 loc) · 1.89 KB
/
Case0003UnzipJsonForFeederSimulation.java
File metadata and controls
46 lines (39 loc) · 1.89 KB
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
43
44
45
46
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 Case0003UnzipJsonForFeederSimulation extends Simulation {
HttpProtocolBuilder httpProtocol =
http
.baseUrl("https://postman-echo.com");
FeederBuilder<Object> feederUnzip = jsonFile("feeders/tounzip.json.zip").unzip().random();
FeederBuilder<Object> feederUngzip = jsonFile("feeders/toungzip.json.gz").unzip().random();
ScenarioBuilder scn =
scenario("GeMi_UnzipJsonForFeederSimulation")
.feed(feederUnzip)
.exec(
http("GeMi_UnzipJsonForFeederSimulation_feederUnzip_post")
.post("/post")
.body(StringBody("#{foo}"))
.asJson()
.check(
jmesPath("json.fruits[?details.size >= `500`].name").is("[\"Apple\"]")
)
)
.feed(feederUngzip)
.exec(
http("GeMi_UnGzipJsonForFeederSimulation_feederUngzip_post")
.post("/post")
.body(StringBody("#{bar}"))
.asJson()
.check(
jmesPath("json.fruits[?details.size >= `500`].name").is("[\"Apple\"]")
)
);
{
setUp(scn.injectOpen(atOnceUsers(1)).protocols(httpProtocol));
}
}