FeatureBackend { public ScriptValueMap handle(ScriptValueMap args, Scenario scenario) { context.vars.putAll(args); isMatchingScenario(scenario); for (Step step : scenario.getSteps()) { Result result = Engine.executeStep(step, actions); if (result.isAborted()) { context.logger.debug("abort at {}:{}", featureName, step.getLine()); break; } if (result.isFailed()) { String message = "server-side scenario failed - " + featureName + ":" + step.getLine(); context.logger.error(message); throw new KarateException(message, result.getError()); } } return context.vars; } FeatureBackend(Feature feature);  FeatureBackend(Feature feature, Map<String, Object> arg); ScenarioContext getContext(); String getFeatureName(); ScriptValueMap handle(ScriptValueMap args, Scenario scenario); List<FeatureScenarioMatch> getMatchingScenarios(ScriptValueMap args); Scenario getDefaultScenario(ScriptValueMap args); HttpResponse corsCheck(HttpRequest request, long startTime); HttpResponse buildResponse(HttpRequest request, long startTime, Scenario scenario, ScriptValueMap args);  }
@Test public void testServer() { Feature feature = FeatureParser.parse(FileUtils.getFileRelativeTo(getClass(), "server.feature")); FeaturesBackend backend = new FeaturesBackend(feature); ScriptValueMap vars = backend.handle(getRequest("Billie")); Match.equals(vars.get("response").getAsMap(), "{ id: 1, name: 'Billie' }"); vars = backend.handle(getRequest("Wild")); Match.equals(vars.get("response").getAsMap(), "{ id: 2, name: 'Wild' }"); List<Map> list = vars.get("cats").getAsList(); Match.equals(list, "[{ id: 1, name: 'Billie' }, { id: 2, name: 'Wild' }]"); }