Search in sources :

Example 1 with NullEmbedderMonitor

use of org.jbehave.core.embedder.NullEmbedderMonitor in project allure-java by allure-framework.

the class AllureJbehaveTest method runStories.

private AllureResults runStories(final String... storyResources) {
    final AllureResultsWriterStub writer = new AllureResultsWriterStub();
    final AllureLifecycle lifecycle = new AllureLifecycle(writer);
    final Embedder embedder = new Embedder();
    embedder.useEmbedderMonitor(new NullEmbedderMonitor());
    embedder.useEmbedderControls(new EmbedderControls().doGenerateViewAfterStories(false).doFailOnStoryTimeout(false).doBatch(false).doIgnoreFailureInStories(true).doIgnoreFailureInView(true).doVerboseFailures(false).doVerboseFiltering(false));
    final AllureJbehave allureJbehave = new AllureJbehave(lifecycle);
    embedder.useConfiguration(new MostUsefulConfiguration().useStoryLoader(new LoadFromClasspath(this.getClass())).useStoryReporterBuilder(new ReportlessStoryReporterBuilder(temp.toFile()).withReporters(allureJbehave)).useDefaultStoryReporter(new NullStoryReporter()));
    final InjectableStepsFactory stepsFactory = new InstanceStepsFactory(embedder.configuration(), new SimpleStorySteps(), new BrokenStorySteps());
    embedder.useCandidateSteps(stepsFactory.createCandidateSteps());
    final AllureLifecycle cached = Allure.getLifecycle();
    try {
        Allure.setLifecycle(lifecycle);
        embedder.runStoriesAsPaths(Arrays.asList(storyResources));
    } finally {
        Allure.setLifecycle(cached);
    }
    return writer;
}
Also used : InjectableStepsFactory(org.jbehave.core.steps.InjectableStepsFactory) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) AllureResultsWriterStub(io.qameta.allure.test.AllureResultsWriterStub) Embedder(org.jbehave.core.embedder.Embedder) NullStoryReporter(org.jbehave.core.reporters.NullStoryReporter) SimpleStorySteps(io.qameta.allure.jbehave.samples.SimpleStorySteps) BrokenStorySteps(io.qameta.allure.jbehave.samples.BrokenStorySteps) NullEmbedderMonitor(org.jbehave.core.embedder.NullEmbedderMonitor) LoadFromClasspath(org.jbehave.core.io.LoadFromClasspath) InstanceStepsFactory(org.jbehave.core.steps.InstanceStepsFactory) EmbedderControls(org.jbehave.core.embedder.EmbedderControls) AllureLifecycle(io.qameta.allure.AllureLifecycle)

Example 2 with NullEmbedderMonitor

use of org.jbehave.core.embedder.NullEmbedderMonitor in project allure-java by reportportal.

the class BaseTest method run.

public static void run(@Nonnull final Class<?> clazz, @Nonnull final Format format, @Nonnull final List<String> stories, @Nonnull final StoryParser parser, @Nullable final Object... steps) {
    Properties viewResources = new Properties();
    Embedder embedder = new Embedder();
    embedder.useEmbedderMonitor(new NullEmbedderMonitor());
    embedder.useEmbedderControls(new EmbedderControls().doGenerateViewAfterStories(false).doFailOnStoryTimeout(false).doBatch(false).doIgnoreFailureInStories(true).doIgnoreFailureInView(true).doVerboseFailures(false).doVerboseFiltering(false));
    embedder.useConfiguration(new MostUsefulConfiguration().useStoryLoader(new LoadFromClasspath(clazz)).useStoryPathResolver(new UnderscoredCamelCaseResolver()).useStoryParser(parser).useStoryReporterBuilder(new StoryReporterBuilder().withDefaultFormats().withPathResolver(new FilePrintStreamFactory.ResolveToPackagedName()).withViewResources(viewResources).withFormats(format).withFailureTrace(true).withFailureTraceCompression(true)));
    final InjectableStepsFactory stepsFactory = new InstanceStepsFactory(embedder.configuration(), steps == null ? Collections.emptyList() : Arrays.asList(steps));
    embedder.useCandidateSteps(stepsFactory.createCandidateSteps());
    embedder.runStoriesAsPaths(stories);
}
Also used : InjectableStepsFactory(org.jbehave.core.steps.InjectableStepsFactory) StoryReporterBuilder(org.jbehave.core.reporters.StoryReporterBuilder) NullEmbedderMonitor(org.jbehave.core.embedder.NullEmbedderMonitor) MostUsefulConfiguration(org.jbehave.core.configuration.MostUsefulConfiguration) LoadFromClasspath(org.jbehave.core.io.LoadFromClasspath) InstanceStepsFactory(org.jbehave.core.steps.InstanceStepsFactory) Embedder(org.jbehave.core.embedder.Embedder) FilePrintStreamFactory(org.jbehave.core.reporters.FilePrintStreamFactory) EmbedderControls(org.jbehave.core.embedder.EmbedderControls) UnderscoredCamelCaseResolver(org.jbehave.core.io.UnderscoredCamelCaseResolver)

Aggregations

MostUsefulConfiguration (org.jbehave.core.configuration.MostUsefulConfiguration)2 Embedder (org.jbehave.core.embedder.Embedder)2 EmbedderControls (org.jbehave.core.embedder.EmbedderControls)2 NullEmbedderMonitor (org.jbehave.core.embedder.NullEmbedderMonitor)2 LoadFromClasspath (org.jbehave.core.io.LoadFromClasspath)2 InjectableStepsFactory (org.jbehave.core.steps.InjectableStepsFactory)2 InstanceStepsFactory (org.jbehave.core.steps.InstanceStepsFactory)2 AllureLifecycle (io.qameta.allure.AllureLifecycle)1 BrokenStorySteps (io.qameta.allure.jbehave.samples.BrokenStorySteps)1 SimpleStorySteps (io.qameta.allure.jbehave.samples.SimpleStorySteps)1 AllureResultsWriterStub (io.qameta.allure.test.AllureResultsWriterStub)1 UnderscoredCamelCaseResolver (org.jbehave.core.io.UnderscoredCamelCaseResolver)1 FilePrintStreamFactory (org.jbehave.core.reporters.FilePrintStreamFactory)1 NullStoryReporter (org.jbehave.core.reporters.NullStoryReporter)1 StoryReporterBuilder (org.jbehave.core.reporters.StoryReporterBuilder)1