Runner { public static Map<String, Object> runFeature(Feature feature, Map<String, Object> vars, boolean evalKarateConfig) { CallContext callContext = new CallContext(vars, evalKarateConfig); FeatureResult result = Engine.executeFeatureSync(null, feature, null, callContext); if (result.isFailed()) { throw result.getErrorsCombined(); } return result.getResultAsPrimitiveMap(); }  static Builder path(String... paths); static Builder path(List<String> paths); static Results parallel(Class<?> clazz, int threadCount); static Results parallel(Class<?> clazz, int threadCount, String reportDir); static Results parallel(List<String> tags, List<String> paths, int threadCount, String reportDir); static Results parallel(int threadCount, String... tagsOrPaths); static Results parallel(String reportDir, int threadCount, String... tagsOrPaths); static Results parallel(List<String> tags, List<String> paths, String scenarioName,
            List<ExecutionHook> hooks, int threadCount, String reportDir); static Results parallel(List<Resource> resources, int threadCount, String reportDir); static Results parallel(Builder options); static Map<String, Object> runFeature(Feature feature, Map<String, Object> vars, boolean evalKarateConfig); static Map<String, Object> runFeature(File file, Map<String, Object> vars, boolean evalKarateConfig); static Map<String, Object> runFeature(Class relativeTo, String path, Map<String, Object> vars, boolean evalKarateConfig); static Map<String, Object> runFeature(String path, Map<String, Object> vars, boolean evalKarateConfig); static void callAsync(String path, List<String> tags, Map<String, Object> arg, ExecutionHook hook, Consumer<Runnable> system, Runnable next);  }
@Test public void testRunningFeatureFromJavaApi() { Map<String, Object> result = Runner.runFeature(getClass(), "core/scenario.feature", null, true); assertEquals(1, result.get("a")); Map<String, Object> temp = (Map) result.get("b"); assertEquals("bar", temp.get("foo")); assertEquals("someValue", result.get("someConfig")); }
@Test public void testRunningRelativePathFeatureFromJavaApi() { Map<String, Object> result = Runner.runFeature("classpath:com/intuit/karate/test-called.feature", null, true); assertEquals(1, result.get("a")); assertEquals(2, result.get("b")); assertEquals("someValue", result.get("someConfig")); }