public Runtime build() { final ResourceLoader resourceLoader = this.resourceLoader != null ? this.resourceLoader : new MultiLoader(this.classLoader); final ClassFinder classFinder = this.classFinder != null ? this.classFinder : new ResourceLoaderClassFinder(resourceLoader, this.classLoader); final BackendSupplier backendSupplier = this.backendSupplier != null ? this.backendSupplier : new BackendModuleBackendSupplier(resourceLoader, classFinder, this.runtimeOptions); final Plugins plugins = new Plugins(this.classLoader, new PluginFactory(), this.eventBus, this.runtimeOptions); for (final Plugin plugin : additionalPlugins) { plugins.addPlugin(plugin); } final RunnerSupplier runnerSupplier = runtimeOptions.isMultiThreaded() ? new ThreadLocalRunnerSupplier(this.runtimeOptions, eventBus, backendSupplier) : new SingletonRunnerSupplier(this.runtimeOptions, eventBus, backendSupplier); final ExecutorService executor = runtimeOptions.isMultiThreaded() ? Executors.newFixedThreadPool(runtimeOptions.getThreads()) : new SameThreadExecutorService(); final FeatureLoader featureLoader = new FeatureLoader(resourceLoader); final FeatureSupplier featureSupplier = this.featureSupplier != null ? this.featureSupplier : new FeaturePathFeatureSupplier(featureLoader, this.runtimeOptions); final Filters filters = new Filters(this.runtimeOptions); return new Runtime(plugins, this.runtimeOptions, eventBus, filters, runnerSupplier, featureSupplier, executor); } }
/** * Constructor for FluentCucumber. * * @param clazz runner class * @throws InitializationError problem with initialization * @throws IOException problem with reading feature files */ public FluentCucumber(Class clazz) throws InitializationError, IOException { super(clazz); ClassLoader classLoader = clazz.getClassLoader(); Assertions.assertNoCucumberAnnotatedMethods(clazz); RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory(clazz); RuntimeOptions runtimeOptions = runtimeOptionsFactory.create(); ResourceLoader resourceLoader = new MultiLoader(classLoader); ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader); FluentObjectFactory objectFactory = getFluentObjectFactory(clazz); this.runtime = new Runtime(resourceLoader, classLoader, singletonList(getBackend(classFinder, runtimeOptions, objectFactory)), runtimeOptions); Formatter formatter = runtimeOptions.formatter(classLoader); JUnitOptions junitOptions = new JUnitOptions(runtimeOptions.getJunitOptions()); List<CucumberFeature> cucumberFeatures = runtimeOptions.cucumberFeatures(resourceLoader, this.runtime.getEventBus()); this.jUnitReporter = new JUnitReporter(this.runtime.getEventBus(), runtimeOptions.isStrict(), junitOptions); this.addChildren(cucumberFeatures); }
/** * Create the Runtime. Can be overridden to customize the runtime or backend. * * @param resourceLoader used to load resources * @param classLoader used to load classes * @param runtimeOptions configuration * @return a new runtime */ protected Runtime createRuntime(ResourceLoader resourceLoader, ClassLoader classLoader, RuntimeOptions runtimeOptions) { ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader); return new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions); }
/** * Create the Runtime. Can be overridden to customize the runtime or backend. * * @param resourceLoader used to load resources * @param classLoader used to load classes * @param runtimeOptions configuration * @return a new runtime */ protected Runtime createRuntime(ResourceLoader resourceLoader, ClassLoader classLoader, RuntimeOptions runtimeOptions) { ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader); return new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions); }
/** * Create the Runtime. Can be overridden to customize the runtime or * backend. * * @param resourceLoader * used to load resources * @param classLoader * used to load classes * @param runtimeOptions * configuration * @return a new runtime * @throws InitializationError * if a JUnit error occurred * @throws IOException * if a class or resource could not be loaded */ protected Runtime createRuntime(ResourceLoader resourceLoader, ClassLoader classLoader, RuntimeOptions runtimeOptions) throws InitializationError, IOException { ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader); return new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions); }
/** * Create the Runtime. Can be overridden to customize the runtime or * backend. * * @param resourceLoader * used to load resources * @param classLoader * used to load classes * @param runtimeOptions * configuration * @return a new runtime * @throws InitializationError * if a JUnit error occurred * @throws IOException * if a class or resource could not be loaded */ protected Runtime createRuntime(ResourceLoader resourceLoader, ClassLoader classLoader, RuntimeOptions runtimeOptions) throws InitializationError, IOException { ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader); return new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions); }
private static Runtime createSerenityEnabledRuntime(ResourceLoader resourceLoader, ClassLoader classLoader, ClassFinder classFinder, RuntimeOptions runtimeOptions, Configuration systemConfiguration) { ClassFinder resolvedClassFinder = Optional.ofNullable(classFinder).orElse(new ResourceLoaderClassFinder(resourceLoader, classLoader)); SerenityReporter reporter = new SerenityReporter(systemConfiguration, resourceLoader); Runtime runtime = new Runtime(resourceLoader, resolvedClassFinder, classLoader, runtimeOptions); runtimeOptions.addPlugin(reporter); return runtime; } }
private static Runtime createSerenityEnabledRuntime(ResourceLoader resourceLoader, ClassLoader classLoader, ClassFinder classFinder, RuntimeOptions runtimeOptions, Configuration systemConfiguration) { ClassFinder resolvedClassFinder = Optional.ofNullable(classFinder).orElse(new ResourceLoaderClassFinder(resourceLoader, classLoader)); SerenityReporter reporter = new SerenityReporter(systemConfiguration, resourceLoader); Runtime runtime = new Runtime(resourceLoader, resolvedClassFinder, classLoader, runtimeOptions); runtimeOptions.addPlugin(reporter); return runtime; } }
public Runtime build() { if (classLoader == null) classLoader = testClass == null ? Thread.currentThread().getContextClassLoader() : testClass.getClassLoader(); if (resourceLoader == null) resourceLoader = new MultiLoader(classLoader); if (pluginFactory == null) pluginFactory = new PluginFactory(); if (runtimeOptions == null) { Preconditions.checkArgument(!args.isEmpty() || testClass != null, "RuntimeOptions not provided, need args or testClass"); runtimeOptions = args.isEmpty() ? new RuntimeOptionsFactory(testClass).create() : new RuntimeOptions(pluginFactory, args); } runtimeOptions.getFeaturePaths().addAll(featurePaths); for (Object plugin : plugins) { runtimeOptions.addPlugin(plugin); } String progressOutputFilePath = System.getProperty("minium.cucumber.progressOutputFile", null); if (progressOutputFilePath != null) { File progressOutputFile = new File(progressOutputFilePath); runtimeOptions.addPlugin(new ProgressFormatter(progressOutputFile)); } runtime = new Runtime(resourceLoader, classLoader, backends, runtimeOptions); return runtime; }
public static Runtime createSerenityEnabledRuntime(ResourceLoader resourceLoader, ClassLoader classLoader, RuntimeOptions runtimeOptions, Configuration systemConfiguration) { ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader); setRuntimeOptions(runtimeOptions); Runtime runtime = new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions); //the order here is important, add plugin after the runtime is created SerenityReporter reporter = new SerenityReporter(systemConfiguration, resourceLoader); runtimeOptions.addPlugin(reporter); return runtime; }
public static Runtime createSerenityEnabledRuntime(ResourceLoader resourceLoader, ClassLoader classLoader, RuntimeOptions runtimeOptions, Configuration systemConfiguration) { ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader); setRuntimeOptions(runtimeOptions); Runtime runtime = new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions); //the order here is important, add plugin after the runtime is created SerenityReporter reporter = new SerenityReporter(systemConfiguration, resourceLoader); runtimeOptions.addPlugin(reporter); return runtime; }
runtime = new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions);
/** * Constructor for FluentCucumber. * * @param clazz runner class * @throws InitializationError problem with initialization * @throws IOException problem with reading feature files */ public FluentCucumber(Class clazz) throws InitializationError, IOException { super(clazz); ClassLoader classLoader = clazz.getClassLoader(); Assertions.assertNoCucumberAnnotatedMethods(clazz); RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory(clazz); RuntimeOptions runtimeOptions = runtimeOptionsFactory.create(); ResourceLoader resourceLoader = new MultiLoader(classLoader); ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader); FluentObjectFactory objectFactory = getFluentObjectFactory(clazz); this.runtime = new Runtime(resourceLoader, classLoader, singletonList(getBackend(classFinder, runtimeOptions, objectFactory)), runtimeOptions); Formatter formatter = runtimeOptions.formatter(classLoader); JUnitOptions junitOptions = new JUnitOptions(runtimeOptions.getJunitOptions()); List<CucumberFeature> cucumberFeatures = runtimeOptions.cucumberFeatures(resourceLoader, this.runtime.getEventBus()); this.jUnitReporter = new JUnitReporter(this.runtime.getEventBus(), runtimeOptions.isStrict(), junitOptions); this.addChildren(cucumberFeatures); }