use of cucumber.runtime.HookDefinition in project cucumber-jvm by cucumber.
the class JSONPrettyFormatterTest method runFeaturesWithJSONPrettyFormatter.
private File runFeaturesWithJSONPrettyFormatter(final List<String> featurePaths) throws IOException {
HookDefinition hook = mock(HookDefinition.class);
when(hook.matches(anyListOf(Tag.class))).thenReturn(true);
File report = File.createTempFile("cucumber-jvm-junit", ".json");
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
final ClasspathResourceLoader resourceLoader = new ClasspathResourceLoader(classLoader);
List<String> args = new ArrayList<String>();
args.add("--plugin");
args.add("json:" + report.getAbsolutePath());
args.addAll(featurePaths);
RuntimeOptions runtimeOptions = new RuntimeOptions(args);
Backend backend = mock(Backend.class);
when(backend.getSnippet(any(Step.class), any(FunctionNameGenerator.class))).thenReturn("TEST SNIPPET");
final Runtime runtime = new Runtime(resourceLoader, classLoader, asList(backend), runtimeOptions, new StopWatch.Stub(1234), null);
runtime.getGlue().addBeforeHook(hook);
runtime.run();
return report;
}
Aggregations