Package io.karatelabs.gatling
Class KarateProtocolBuilder
java.lang.Object
io.karatelabs.gatling.KarateProtocolBuilder
- All Implemented Interfaces:
io.gatling.javaapi.core.ProtocolBuilder
public final class KarateProtocolBuilder
extends Object
implements io.gatling.javaapi.core.ProtocolBuilder
Builder for creating KarateProtocol instances.
Provides a fluent API for configuring URI patterns and request naming.
Example usage:
KarateProtocolBuilder protocol = karateProtocol(
uri("/cats/{id}").nil(),
uri("/cats").pauseFor(method("get", 10), method("post", 20))
).nameResolver((req, vars) -> req.getPath());
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal io.karatelabs.core.Runner.BuilderMutableRunner.Builderfor configuring underlying Karate execution. -
Constructor Summary
ConstructorsConstructorDescriptionKarateProtocolBuilder(KarateUriPattern... patterns) Create a new protocol builder with the given URI patterns. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the KarateProtocol.nameResolver(BiFunction<io.karatelabs.http.HttpRequest, Map<String, Object>, String> resolver) Set a custom name resolver for HTTP requests.io.gatling.core.protocol.Protocolprotocol()
-
Field Details
-
runner
public final io.karatelabs.core.Runner.Builder runnerMutableRunner.Builderfor configuring underlying Karate execution. Mirrors the v1protocol.runnerfield — setkarateEnv,configDir,systemProperty, etc. directly on it.Example:
protocol.runner.karateEnv("perf").configDir("src/test/resources");Protocol-scoped callSingle and callOnce/setupOnce caches are also pre-wired onto this builder. They live for the lifetime of the simulation (one protocol = one setUp), so an expensive
karate.callSingle(...)or a feature-levelcallonceruns once per simulation rather than once per virtual user.
-
-
Constructor Details
-
KarateProtocolBuilder
Create a new protocol builder with the given URI patterns.
-
-
Method Details
-
nameResolver
public KarateProtocolBuilder nameResolver(BiFunction<io.karatelabs.http.HttpRequest, Map<String, Object>, String> resolver) Set a custom name resolver for HTTP requests. The resolver receives the HttpRequest and scenario variables, returning a custom name for Gatling reporting.- Parameters:
resolver- the name resolver function- Returns:
- this builder for chaining
-
build
Build the KarateProtocol. -
protocol
public io.gatling.core.protocol.Protocol protocol()- Specified by:
protocolin interfaceio.gatling.javaapi.core.ProtocolBuilder
-