/** * {@inheritDoc} */ @Override public void addPlugin(Object plugin) { this.ros.addPlugin(plugin); }
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; }
/** * Bootstrap the cucumber runtime * * @param clazz Which has the cucumber.api.CucumberOptions and org.testng.annotations.Test annotations */ public TestNGZucchiniRunner(Class<?> clazz) { ClassLoader classLoader = clazz.getClassLoader(); ResourceLoader resourceLoader = new MultiLoader(classLoader); RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory(clazz); RuntimeOptions runtimeOptions = runtimeOptionsFactory.create(); /* Add the custom Zucchini Formatter */ CucumberJSONFormatter formatter = new CucumberJSONFormatter(output); runtimeOptions.addPlugin(formatter); this.formatters = getAllPlugins(runtimeOptions); ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader); runtime = new ZucchiniRuntime(resourceLoader, classFinder, classLoader, runtimeOptions); }
public void performInternalCucumberOperations(final Object testInstance, final TEST_NOTIFIER runNotifier) throws Exception { final Class<?> javaTestClass = getTestedClass(); final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); final InputStream configurationInputStream = classLoader.getResourceAsStream(ClientServerFiles.CONFIG); final Properties cukespaceConfigurationProperties = loadCucumberConfigurationProperties(configurationInputStream); final RuntimeOptions runtimeOptions = loadRuntimeOptions(javaTestClass, cukespaceConfigurationProperties); final boolean reported = Boolean.parseBoolean(cukespaceConfigurationProperties.getProperty(CucumberConfiguration.REPORTABLE, "false")); final StringBuilder reportBuilder = new StringBuilder(); if (reported) { runtimeOptions.addPlugin(new JSONFormatter(reportBuilder)); } final InputStream gluesInputStream = classLoader.getResourceAsStream(ClientServerFiles.GLUES_LIST); final Collection<Class<?>> glues = loadGlues(gluesInputStream, classLoader, javaTestClass); final ArquillianBackend arquillianBackend = new ArquillianBackend( glues, javaTestClass, testInstance, cukespaceConfigurationProperties.getProperty(CucumberConfiguration.OBJECT_FACTORY)); final CucumberRuntime cucumberRuntime = new CucumberRuntime(null, classLoader, singletonList(arquillianBackend), runtimeOptions); final Map<String, Collection<URL>> featuresMap = Features.createFeatureMap(CucumberConfiguration.instance().getTempDir(), cukespaceConfigurationProperties.getProperty(CucumberConfiguration.FEATURE_HOME), javaTestClass, classLoader); final List<CucumberFeature> cucumberFeatures = getCucumberFeatures(runtimeOptions.getFilters(), testInstance, classLoader, featuresMap); final Formatter formatter = runtimeOptions.formatter(classLoader); final Reporter reporter = runtimeOptions.reporter(classLoader); final StepDefinitionReporter stepDefinitionReporter = runtimeOptions.stepDefinitionReporter(classLoader); cucumberRuntime.getGlue().reportStepDefinitions(stepDefinitionReporter); runFeatures(cucumberFeatures, cucumberRuntime, getReporter(reporter, formatter, runtimeOptions), runNotifier); if (reported) { final String path = cukespaceConfigurationProperties.getProperty(CucumberConfiguration.REPORTABLE_PATH); addReportTestIntoFile(path, javaTestClass, reportBuilder); } handleCucumberTestErrors(cucumberRuntime.getErrors(), cucumberRuntime); }
for (String format : reportformatList) { Object formatObj = pluginFactory.create(format); runtimeOptions.addPlugin(formatObj);
for (String format : reportformatList) { Object formatObj = pluginFactory.create(format); runtimeOptions.addPlugin(formatObj);