karatelabs/karate · warning
skipping scenario outline in mock
Error message
skipping scenario outline in mock - {}:{} What it means
MockHandler iterates the feature's sections to find a scenario matching the incoming mock HTTP request. Scenario Outlines cannot be executed by the mock server (mocking resolves a single concrete scenario per request), so any outline section is skipped with this warning and matching continues with the plain scenarios.
Solutions
- Split the mock feature so each concrete case is a plain Scenario (no Examples) with the request matchers the mock should respond to.
- Generate/unroll the outline rows into separate scenarios in the mock feature.
- Keep a dedicated mock-only feature file separate from the test features.
- If the outline behavior is needed, handle it in a custom mock implementation or request handler rather than a Scenario Outline.
Example fix
// before
Scenario Outline: mock user
* def name = '<name>'
Examples: | name |
| bob |
// after
Scenario: mock user bob
* def name = 'bob' Defensive patterns
Strategy: validation
Validate before calling
// Before starting the mock, assert the feature has no outlines
for (FeatureSection s : feature.getSections()) {
if (s.isOutline()) {
throw new IllegalStateException("mock feature must not contain Scenario Outline at line " + s.getScenarioOutline().getLine());
}
} Prevention
- Author dedicated mock features with plain Scenarios only
- Add a build-time check that scans mock features for Scenario Outline blocks
- If data-driven mocking is needed, generate one scenario per Examples row instead
When it happens
Trigger: Starting a Karate mock server (Karate.mockServer / MockHandler) against a feature whose Scenario Outline blocks would be candidates for an incoming request; handleRequest then logs this per outline section and never uses the outline's Examples rows.
Common situations: Pointing a mock at a reused test feature file that contains outlines instead of authoring a dedicated mock feature; a refactor converts a scenario into an outline and mock coverage silently disappears; developers expecting Examples-based responses from the mock.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- at least one feature file is required
- def requires '=' assignment
- hook failed
- mock background failed at line
- proceed() can only be called within a mock scenario
AI-assisted analysis of karatelabs/karate@a22eb90246 (2026-09-12).
Data as JSON: /api/errors/1b4e1302d46bf38b.
Report an issue: GitHub.
Appendix: source
Thrown at karate-core/src/main/java/io/karatelabs/core/MockHandler.java:402
// Process body for form-urlencoded and multipart
request.processBody();
// Find matching scenario and execute
for (Feature feature : features) {
ScenarioRuntime runtime = runtimes.get(feature);
Engine engine = runtime.getEngine();
// Drop any values marked request-derived by a previous request before this one's
// bindings are read again, so the identity set never accumulates stale entries.
runtime.clearRequestDerived();
// Set up request variables (includes storing HttpRequest for matcher functions)
setupRequestVariables(engine, request);
for (FeatureSection section : feature.getSections()) {
if (section.isOutline()) {
logger.warn("skipping scenario outline in mock - {}:{}", feature, section.getScenarioOutline().getLine());
continue;
}
Scenario scenario = section.getScenario();
if (isMatchingScenario(scenario, engine)) {
return executeScenario(runtime, scenario, request);
}
}
}
// No match found - return 404
logger.warn("no scenarios matched, returning 404: {} {}", request.getMethod(), request.getPath());
return createNotFoundResponse();
}
private HttpResponse handleCorsPreFlight(HttpRequest request) {
HttpResponse response = new HttpResponse();
response.setStatus(200);View on GitHub (pinned to a22eb90246)