cucumber.runtime.RuntimeOptionsFactory Java Examples
The following examples show how to use
cucumber.runtime.RuntimeOptionsFactory.
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: CucumberLoadRunner.java From cukes with Apache License 2.0 | 6 votes |
/** * Constructor called by JUnit. * * @param clazz the class with the @RunWith annotation. * @throws java.io.IOException if there is a problem * @throws org.junit.runners.model.InitializationError if there is another problem */ public CucumberLoadRunner(Class clazz) throws InitializationError, IOException { super(clazz); System.setProperty(cukesProperty(CONTEXT_INFLATING_ENABLED), "false"); System.setProperty(cukesProperty(ASSERTIONS_DISABLED), "true"); System.setProperty(cukesProperty(LOADRUNNER_FILTER_BLOCKS_REQUESTS), "true"); filter = SingletonObjectFactory.instance().getInstance(LoadRunnerFilter.class); ClassLoader classLoader = clazz.getClassLoader(); Assertions.assertNoCucumberAnnotatedMethods(clazz); RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory(clazz); RuntimeOptions runtimeOptions = runtimeOptionsFactory.create(); ResourceLoader resourceLoader = new MultiLoader(classLoader); runtime = createRuntime(resourceLoader, classLoader, runtimeOptions); final List<CucumberFeature> cucumberFeatures = runtimeOptions.cucumberFeatures(resourceLoader); jUnitReporter = new JUnitReporter(runtimeOptions.reporter(classLoader), runtimeOptions.formatter(classLoader), runtimeOptions.isStrict(), new JUnitOptions(runtimeOptions.getJunitOptions())); addChildren(cucumberFeatures); }
Example #2
Source File: QuantumReportiumListener.java From Quantum with MIT License | 5 votes |
private RuntimeOptions getCucumberOptions(ITestResult testResult) { try { return new RuntimeOptionsFactory(Class.forName(testResult.getTestClass().getName())).create(); } catch (ClassNotFoundException e) { e.printStackTrace(); } return null; }
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); }