Gatling version: 3.11.5
Gatling flavor: java
Gatling build tool: maven
Hello, I am using the gatling grpc dependency with java.
I want to load test a grpc server streaming operation that is exposed by my application.
As I understand I can only apply checks when declaring my
GrpcServerStreamingServiceBuilder<Request, Response> as follows:
GrpcServerStreamingServiceBuilder<Request, Response> stream = GrpcDsl.grpc("Query")
.serverStream(QueryServiceGrpc.getQueryMethod())
.check(GrpcDsl.statusCode().is(Status.Code.OK))
.check(GrpcDsl.statusCode().saveAs("statusCode"))
.check(response(o -> {
applyCustomChecks((Response) o );
return response;
}))
CoreDsl.scenario("Query")
.exec(
session -> {
Request request = getRequest();
log.info(id + " Session " + session.userId());
log.info(id + " Headers " + scenario.getHeaders());
log.info(id + " Request Body " + request);
session = session.set("request", request);
return session;
})
.exec(
stream.send(session -> (QueryRequest) session.get("request")),
stream.awaitStreamEnd()
)
.exec(session -> {
if(responseIterator> getExpectedNumberOfResponses()) {
session=session.markAsFailed();
}
return session;
});
These checks are applied in each response. However I want to also apply some checks in the overall process. For example, I want to assert that the total number of responses is equal to 5.
How can I apply checks in the end of all the responses? I tried adding an exec block in which i make the session as failed. However the requests and responses keep being displayed as OK instead of KO.
Thank you in advance,
George