org.jbehave.core.configuration.MostUsefulConfiguration Java Examples

The following examples show how to use org.jbehave.core.configuration.MostUsefulConfiguration. 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: AllureJbehaveTest.java    From allure-java with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: Stories.java    From attic-rave with Apache License 2.0 6 votes vote down vote up
@Override
public Configuration configuration() {
    Class<? extends Embeddable> embeddableClass = this.getClass();
    // Start from default ParameterConverters instance
    ParameterConverters parameterConverters = new ParameterConverters();
    // factory to allow parameter conversion and loading from external resources (used by StoryParser too)
    ExamplesTableFactory examplesTableFactory = new ExamplesTableFactory(new LocalizedKeywords(), new LoadFromClasspath(embeddableClass), parameterConverters);
    // add custom converters
    parameterConverters.addConverters(
            new DateConverter(new SimpleDateFormat("yyyy-MM-dd")),
            new ParameterConverters.EnumConverter()
    );
    return new MostUsefulConfiguration()
            .useStoryLoader(new LoadFromClasspath(embeddableClass))
            .useStoryParser(new RegexStoryParser(examplesTableFactory))
            .useStoryReporterBuilder(new StoryReporterBuilder()
                    .withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass))
                    .withDefaultFormats()
                    .withFormats(CONSOLE, TXT, HTML, XML))
            .useParameterConverters(parameterConverters);
}
 
Example #3
Source File: LogSearchBackendStories.java    From ambari-logsearch with Apache License 2.0 5 votes vote down vote up
@Override
public Configuration configuration() {
  return new MostUsefulConfiguration()
    .useStoryLoader(LogSearchStoryLocator.getStoryLoader(BACKEND_STORIES_LOCATION_PROPERTY, this.getClass()))
    .useStoryReporterBuilder(
      new StoryReporterBuilder().withFailureTrace(true).withDefaultFormats().withFormats(Format.CONSOLE, Format.TXT));
}
 
Example #4
Source File: JBehaveTest.java    From Test-Driven-Java-Development-Second-Edition with MIT License 5 votes vote down vote up
@Override
public Configuration configuration() {
    Properties viewResources = new Properties();
    viewResources.put("decorateNonHtml", "true");
    return new MostUsefulConfiguration()
            .useStoryLoader(new LoadFromClasspath(this.getClass()))
            .useStoryPathResolver(new StoryResolver())
            .useStoryReporterBuilder(new StoryReporterBuilder()
                    .withViewResources(viewResources)
                    .withCodeLocation(
                            CodeLocations.codeLocationFromPath("build/reports/jbehave"))
                    .withFailureTrace(true)
                    .withDefaultFormats()
                    .withFormats(Format.CONSOLE, Format.HTML));
}
 
Example #5
Source File: JBConfiguratorImpl.java    From colibri-ui with Apache License 2.0 5 votes vote down vote up
@Override
public Configuration createConfig(ViewGenerator viewGenerator, Format... formats) {
    Configuration configuration = new MostUsefulConfiguration();
    configuration.useStoryReporterBuilder(
            new StoryReporterBuilder()
                    .withFormats(formats))
            .useViewGenerator(viewGenerator);
    configuration.useStoryControls(new StoryControls().doResetStateBeforeScenario(true));
    configuration.parameterConverters().addConverters(new ParameterConverters.EnumConverter());
    return configuration;
}
 
Example #6
Source File: AbstractSpringJBehaveStory.java    From angularjs-springmvc-sample-boot with Apache License 2.0 5 votes vote down vote up
@Override
public Configuration configuration() {
    return new MostUsefulConfiguration()
            .useStoryPathResolver(storyPathResolver())
            .useStoryLoader(storyLoader())
            .useStoryReporterBuilder(storyReporterBuilder())
            .useParameterControls(parameterControls());
}
 
Example #7
Source File: UserRegistrationScenarios.java    From user-registration-V2 with Apache License 2.0 5 votes vote down vote up
@Override
public Configuration configuration() {
	LocalizedKeywords keywords = new LocalizedKeywords(new Locale("de"));
	return new MostUsefulConfiguration()
			.useKeywords(keywords)
			.useStepCollector(new MarkUnmatchedStepsAsPending(keywords))
			.useStoryParser(new RegexStoryParser(keywords))

			.useStoryLoader(new LoadFromClasspath(this.getClass()))
			.useFailureStrategy(new RethrowingFailure())
			.useStoryReporterBuilder(
					new StoryReporterBuilder().withKeywords(keywords)
							.withFormats(Format.HTML, Format.ANSI_CONSOLE)
							.withFailureTrace(true));
}
 
Example #8
Source File: ICanAddValues.java    From chuidiang-ejemplos with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Configuration configuration() {
    return new MostUsefulConfiguration()
        // where to find the stories
        .useStoryLoader(new LoadFromClasspath(this.getClass()))  
        // CONSOLE and TXT reporting
        .useStoryReporterBuilder(new StoryReporterBuilder().withDefaultFormats().withFormats(Format.CONSOLE, Format.TXT)); 
}
 
Example #9
Source File: Stories.java    From metrics-kafka with Apache License 2.0 5 votes vote down vote up
@Override
public Configuration configuration() {
    return new MostUsefulConfiguration()
            .useStoryLoader(new LoadFromClasspath(this.getClass()))
            .useStoryReporterBuilder(new StoryReporterBuilder()
                    .withFormats(Format.TXT)
                    .withRelativeDirectory("../build/jbehave/"));
}
 
Example #10
Source File: AbstractStory.java    From tutorials with MIT License 5 votes vote down vote up
@Override
public Configuration configuration() {
    return new MostUsefulConfiguration()
      .useStoryLoader(new LoadFromClasspath(this.getClass()))
      .useStoryReporterBuilder(new StoryReporterBuilder()
        .withCodeLocation(codeLocationFromClass(this.getClass()))
        .withFormats(CONSOLE));
}
 
Example #11
Source File: IncreaseStoryLiveTest.java    From tutorials with MIT License 5 votes vote down vote up
@Override
public Configuration configuration() {
    return new MostUsefulConfiguration()
      .useStoryLoader(new LoadFromClasspath(this.getClass()))
      .useStoryReporterBuilder(new StoryReporterBuilder()
        .withCodeLocation(codeLocationFromClass(this.getClass()))
        .withFormats(CONSOLE));
}
 
Example #12
Source File: Runner.java    From Test-Driven-Java-Development-Second-Edition with MIT License 4 votes vote down vote up
@Override
public Configuration configuration() {
    return new MostUsefulConfiguration()
            .useStoryReporterBuilder(getReporter())
            .useStoryLoader(new LoadFromURL());
}
 
Example #13
Source File: UserRegistrationScenarios.java    From user-registration-V2 with Apache License 2.0 4 votes vote down vote up
@Override
public Configuration configuration() {
	return new MostUsefulConfiguration().useStoryLoader(new LoadFromClasspath(this.getClass()))
			.useFailureStrategy(new RethrowingFailure()).useStoryReporterBuilder(new StoryReporterBuilder()
					.withFormats(Format.HTML, Format.ANSI_CONSOLE).withFailureTrace(true));
}