cucumber.runtime.formatter.PluginFactory Java Examples
The following examples show how to use
cucumber.runtime.formatter.PluginFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CucumberRunner.java From cucumber-performance with MIT License | 6 votes |
/** * Builds local runtime instead of using cucumber runtime class. */ private void BuildRuntime() { Supplier<ClassLoader> classLoader = CucumberRunner.class::getClassLoader; ObjectFactoryServiceLoader objectFactoryServiceLoader = new ObjectFactoryServiceLoader(runtimeOptions); ObjectFactorySupplier objectFactory = new SingletonObjectFactorySupplier(objectFactoryServiceLoader); BackendServiceLoader backendSupplier = new BackendServiceLoader(classLoader, objectFactory); TypeRegistryConfigurerSupplier typeRegistryConfigurerSupplier = new ScanningTypeRegistryConfigurerSupplier(classLoader, runtimeOptions); runnerSupplier = new ThreadLocalRunnerSupplier(runtimeOptions, eventBus, backendSupplier, objectFactory, typeRegistryConfigurerSupplier); // can cull out pretty here // Plugins orgPlugins = new Plugins(this.classLoader, new PluginFactory(), // this.eventBus, this.runtimeOptions); // this.plugins = new Plugins(classLoader, new PluginFactory(), eventBus, new // RuntimeOptions(new ArrayList<String>())); // for (final Plugin plugin : orgPlugins) { // if(!(plugin instanceof PrettyFormatter)) // { // plugins.addPlugin(plugin); // } // } this.plugins = new Plugins(new PluginFactory(), runtimeOptions); this.plugins.setEventBusOnEventListenerPlugins(eventBus); this.plugins.setSerialEventBusOnEventListenerPlugins(eventBus); this.featureSupplier = new FeaturePathFeatureSupplier(classLoader, this.runtimeOptions, null); this.filters = new Filters(this.runtimeOptions); }
Example #2
Source File: CucumberReportAdapter.java From openCypher with Apache License 2.0 | 5 votes |
private void initCucumberPlugins() { PluginFactory pluginFactory = new PluginFactory(); RuntimeOptions options = new RuntimeOptions(""); options.getPluginFormatterNames() .stream() .map(pluginFactory::create) .filter(EventListener.class::isInstance) .map(EventListener.class::cast) .forEach(json -> json.setEventPublisher(bus)); }
Example #3
Source File: CucumberRunner.java From bdt with Apache License 2.0 | 5 votes |
/** * Bootstrap the cucumber runtime * * @param clazz Which has the cucumber.api.CucumberOptions and org.testng.annotations.Test annotations */ public CucumberRunner(Class clazz) throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, URISyntaxException { ClassLoader classLoader = clazz.getClassLoader(); ResourceLoader resourceLoader = new MultiLoader(classLoader); RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory(clazz); runtimeOptions = runtimeOptionsFactory.create(); String testSuffix = System.getProperty("TESTSUFFIX"); String targetExecutionsPath = "target/executions/"; if (testSuffix != null) { targetExecutionsPath = targetExecutionsPath + testSuffix + "/"; } new File(targetExecutionsPath).mkdirs(); CucumberReporter reporterTestNG = new CucumberReporter(targetExecutionsPath, clazz.getCanonicalName()); addGlue(); ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader); BackendModuleBackendSupplier backendSupplier = new BackendModuleBackendSupplier(resourceLoader, classFinder, runtimeOptions); bus = new TimeServiceEventBus(TimeService.SYSTEM); plugins = new Plugins(classLoader, new PluginFactory(), runtimeOptions); plugins.addPlugin(reporterTestNG); Set<Class<? extends ConcurrentEventListener>> implementers = new Reflections("com.stratio.qa.utils").getSubTypesOf(ConcurrentEventListener.class); for (Class<? extends ConcurrentEventListener> implementerClazz : implementers) { Constructor<?> ctor = implementerClazz.getConstructor(); ctor.setAccessible(true); Object newPlugin = ctor.newInstance(); plugins.addPlugin((ConcurrentEventListener) newPlugin); } FeatureLoader featureLoader = new FeatureLoader(resourceLoader); filters = new Filters(runtimeOptions); this.runnerSupplier = new ThreadLocalRunnerSupplier(runtimeOptions, bus, backendSupplier); featureSupplier = new FeaturePathFeatureSupplier(featureLoader, runtimeOptions); }