this.runnerSupplier = new ThreadLocalRunnerSupplier(runtimeOptions, bus, backendSupplier); this.filters = new Filters(runtimeOptions); this.junitOptions = new JUnitOptions(runtimeOptions.isStrict(), runtimeOptions.getJunitOptions()); final StepDefinitionReporter stepDefinitionReporter = plugins.stepDefinitionReporter();
/** * 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); }
@Override protected JUnitReporter getReporter(final Reporter delegate, final Formatter formatter, final RuntimeOptions runtimeOptions) { return new JUnitReporter( delegate, formatter, runtimeOptions.isStrict(), new JUnitOptions(runtimeOptions.getJunitOptions())); } };
/** * 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"); System.setProperty(AssertionFacade.ASSERTION_FACADE, AssertionFacadeLoadRunnerImpl.class.getCanonicalName()); System.setProperty(VariableFacade.VARIABLE_FACADE, VariableFacadeLoadRunnerImpl.class.getCanonicalName()); 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); }
private void init(RuntimeOptions runtimeOptions, ClassLoader classLoader, ResourceLoader resourceLoader) throws Exception { for (ExtendedRuntimeOptions option : extendedOptions) { retryCount = Math.max(retryCount, option.getRetryCount()); threadsCount = Math.max(threadsCount, option.getThreadsCount()); } final JUnitOptions junitOptions = new JUnitOptions(runtimeOptions.getJunitOptions()); final List<CucumberFeature> cucumberFeatures = runtimeOptions.cucumberFeatures(resourceLoader); jUnitReporter = new JUnitReporter( runtimeOptions.reporter(classLoader), runtimeOptions.formatter(classLoader), runtimeOptions.isStrict(), junitOptions); Method[] retryMethods = this.getPredefinedMethods(RetryAcceptance.class); addChildren(cucumberFeatures, retryMethods); } protected Runtime createRuntime(ResourceLoader resourceLoader, ClassLoader classLoader,
@Override public List<FeatureRunner> getChildren() { final RuntimeOptions runtimeOptions = courgetteLoader.getRuntimeOptions(); final EventBus eventBus = courgetteLoader.getEventBus(); final ResourceLoader resourceLoader = courgetteLoader.getResourceLoader(); final ClassFinder classFinder = courgetteLoader.getClassFinder(); final Filters filters = courgetteLoader.getFilters(); final JUnitOptions jUnitOptions = new JUnitOptions(runtimeOptions.isStrict(), runtimeOptions.getJunitOptions()); final BackendSupplier backendSupplier = new BackendModuleBackendSupplier(resourceLoader, classFinder, runtimeOptions); final ThreadLocalRunnerSupplier runnerSupplier = new ThreadLocalRunnerSupplier(runtimeOptions, eventBus, backendSupplier); final List<FeatureRunner> children = new ArrayList<>(); this.cucumberFeatures.forEach(cucumberFeature -> { try { FeatureRunner runner = new FeatureRunner(cucumberFeature, filters, runnerSupplier, jUnitOptions); runner.getDescription(); children.add(runner); } catch (InitializationError error) { error.printStackTrace(); } }); return children; }
/** * 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); }
/** * 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); }
this.filters = new Filters(runtimeOptions, rerunFilters); this.junitOptions = new JUnitOptions(runtimeOptions.isStrict(), runtimeOptions.getJunitOptions()); Plugins plugins = new Plugins(classLoader, new PluginFactory(), bus, runtimeOptions); final StepDefinitionReporter stepDefinitionReporter = plugins.stepDefinitionReporter();