Java Code Examples for cucumber.runtime.RuntimeOptions#reporter()
The following examples show how to use
cucumber.runtime.RuntimeOptions#reporter() .
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: AllureCucumberJvmTest.java From allure-java with Apache License 2.0 | 5 votes |
private AllureResults runFeature(final String featureResource, final String... moreOptions) { final AllureResultsWriterStub writer = new AllureResultsWriterStub(); final AllureLifecycle lifecycle = new AllureLifecycle(writer); final AllureCucumberJvm cucumberJvm = new AllureCucumberJvm(lifecycle); final ClassLoader classLoader = currentThread().getContextClassLoader(); final ResourceLoader resourceLoader = new MultiLoader(classLoader); final ClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader); final List<String> opts = new ArrayList<>(Arrays.asList( "--glue", "io.qameta.allure.cucumberjvm.samples", "--plugin", "null", "src/test/resources/" + featureResource )); opts.addAll(Arrays.asList(moreOptions)); final RuntimeOptions options = new RuntimeOptions(opts); final Runtime runtime = new Runtime(resourceLoader, classFinder, classLoader, options); options.addPlugin(cucumberJvm); final FeatureResultListener resultListener = new FeatureResultListener( options.reporter(classLoader), options.isStrict() ); final List<CucumberFeature> features = options.cucumberFeatures(resourceLoader); features.forEach(cucumberFeature -> cucumberFeature.run( options.formatter(classLoader), resultListener, runtime) ); return writer; }
Example 3
Source File: ParameterizedCucumber.java From senbot with MIT License | 5 votes |
private ThreadAwareReporter(ThreadAwareFormatter threadAwareWrappedFormatter, final ClassLoader classLoader, final RuntimeOptions runtimeOptions) { this.threadAwareWrappedFormatter = threadAwareWrappedFormatter; this.classLoader = classLoader; this.runtimeOptions = runtimeOptions; threadLocal = new ThreadLocal<Reporter>() { @Override protected Reporter initialValue() { return runtimeOptions.reporter(classLoader); } }; }