Package io.karatelabs.gatling
Class KarateProtocol
java.lang.Object
io.karatelabs.gatling.KarateProtocol
- All Implemented Interfaces:
io.gatling.core.protocol.Protocol
Gatling protocol for Karate feature execution.
Holds configuration for URI patterns, pauses, and request naming.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionBiFunction<io.karatelabs.http.HttpRequest, Map<String, Object>, String> Get the custom name resolver, if configured.io.karatelabs.core.Runner.BuilderGet the underlyingRunner.Buildertemplate configured on the protocol builder.Get all configured URI patterns.booleanpathMatches(String pattern, String path) Check if a path matches a URI pattern.intGet the pause duration for a specific request and method.resolveName(String path) Resolve a path to a matching URI pattern name.resolveRequestName(io.karatelabs.http.HttpRequest request, Map<String, Object> variables) Resolve the request name using the custom resolver or default pattern matching.
-
Field Details
-
KARATE_KEY
Session key for Karate variables passed between features.- See Also:
-
GATLING_KEY
Session key for Gatling variables accessible in features.- See Also:
-
-
Method Details
-
getRunner
public io.karatelabs.core.Runner.Builder getRunner()Get the underlyingRunner.Buildertemplate configured on the protocol builder. May benullif the protocol was constructed without one (e.g., the empty default-protocol fallback). -
getUriPatterns
Get all configured URI patterns. -
getNameResolver
Get the custom name resolver, if configured. -
resolveRequestName
public String resolveRequestName(io.karatelabs.http.HttpRequest request, Map<String, Object> variables) Resolve the request name using the custom resolver or default pattern matching.- Parameters:
request- the HTTP requestvariables- the scenario variables- Returns:
- the request name for reporting
-
resolveName
Resolve a path to a matching URI pattern name.- Parameters:
path- the request path- Returns:
- the matching pattern or null if no match
-
pathMatches
Check if a path matches a URI pattern. Patterns can contain path parameters like "/users/{id}". -
pauseFor
Get the pause duration for a specific request and method.- Parameters:
requestName- the request name (usually the matched pattern)method- the HTTP method- Returns:
- pause duration in milliseconds, or 0 if not configured
-