org.jbehave.core.configuration.Configuration Java Examples

The following examples show how to use org.jbehave.core.configuration.Configuration. 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: 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 #2
Source File: PortalStories.java    From attic-rave with Apache License 2.0 6 votes vote down vote up
protected PortalStories() {
  CrossReference crossReference = new CrossReference().withJsonOnly().withOutputAfterEachStory(true)
      .excludingStoriesWithNoExecutedScenarios(true);
  ContextView contextView = new LocalFrameContextView().sized(640, 120);
  SeleniumContext seleniumContext = new SeleniumContext();
  SeleniumStepMonitor stepMonitor = new SeleniumStepMonitor(contextView, seleniumContext,
      crossReference.getStepMonitor());
  Format[] formats = new Format[]{new SeleniumContextOutput(seleniumContext), CONSOLE, WEB_DRIVER_HTML};
  StoryReporterBuilder reporterBuilder = new StoryReporterBuilder()
      .withCodeLocation(codeLocationFromClass(this.getClass())).withFailureTrace(true)
      .withFailureTraceCompression(true).withDefaultFormats().withFormats(formats)
      .withCrossReference(crossReference);

  Configuration configuration = new SeleniumConfiguration().useSeleniumContext(seleniumContext)
      .useFailureStrategy(new FailingUponPendingStep())
      .useStoryControls(new StoryControls().doResetStateBeforeScenario(false)).useStepMonitor(stepMonitor)
      .useStoryLoader(new LoadFromClasspath(this.getClass()))
      .useStoryReporterBuilder(reporterBuilder);
  useConfiguration(configuration);

  ApplicationContext context = new SpringApplicationContextFactory("applicationContext-tests.xml").createApplicationContext();
  useStepsFactory(new SpringStepsFactory(configuration, context));
}
 
Example #3
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 #4
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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
Source File: JBConfiguratorImpl.java    From colibri-ui with Apache License 2.0 5 votes vote down vote up
@Override
public Configuration createConfig() {
    Configuration configuration = new Configuration() {
    };
    configuration.useStoryReporterBuilder(
            new StoryReporterBuilder()
                    .withDefaultFormats()
                    .withFormats(Format.CONSOLE)
                    .withReporters(allureReporter));
    configuration.useStoryControls(new StoryControls().doResetStateBeforeScenario(true));
    configuration.parameterConverters().addConverters(new ParameterConverters.EnumConverter());
    return configuration;
}
 
Example #11
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 #12
Source File: LogSearchUIStories.java    From ambari-logsearch with Apache License 2.0 5 votes vote down vote up
@Override
public Configuration configuration() {
  Class<? extends Embeddable> embeddableClass = this.getClass();
  return new SeleniumConfiguration()
    .useSeleniumContext(context)
    .useWebDriverProvider(driverProvider)
    .useStoryLoader(LogSearchStoryLocator.getStoryLoader(UI_STORIES_LOCATION_PROPERTY, this.getClass()))
    .useStoryReporterBuilder(new StoryReporterBuilder()
      .withCodeLocation(codeLocationFromClass(embeddableClass))
      .withDefaultFormats()
      .withFormats(CONSOLE, TXT, HTML, XML));
}
 
Example #13
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 #14
Source File: SubSteps.java    From vividus with Apache License 2.0 5 votes vote down vote up
public SubSteps(Configuration configuration, StoryReporter storyReporter, List<Step> steps,
        ISubStepsListener subStepsListener)
{
    this.configuration = configuration;
    this.storyReporter = storyReporter;
    this.steps = steps;
    this.subStepsListener = subStepsListener;
}
 
Example #15
Source File: ParameterConvertersDecorator.java    From vividus with Apache License 2.0 5 votes vote down vote up
public ParameterConvertersDecorator(Configuration configuration, ParameterAdaptor parameterAdaptor,
        ExpressionAdaptor expressionAdaptor)
{
    super(configuration.stepMonitor(), configuration.keywords(), configuration.storyLoader(),
            configuration.parameterControls(), configuration.tableTransformers());
    this.parameterAdaptor = parameterAdaptor;
    this.expressionAdaptor = expressionAdaptor;
}
 
Example #16
Source File: GenericRunner.java    From vividus with Apache License 2.0 4 votes vote down vote up
@Override
public Configuration configuration()
{
    return embedder.configuration();
}
 
Example #17
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 #18
Source File: LogSearchUIStories.java    From ambari-logsearch with Apache License 2.0 4 votes vote down vote up
@Override
public InjectableStepsFactory stepsFactory() {
  Configuration configuration = configuration();
  return new InstanceStepsFactory(configuration, new LogSearchDockerSteps(), new LogSearchUISteps(driverProvider),
    new WebDriverScreenshotOnFailure(driverProvider, configuration.storyReporterBuilder()));
}
 
Example #19
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));
}
 
Example #20
Source File: SpringStepFactory.java    From vividus with Apache License 2.0 4 votes vote down vote up
public SpringStepFactory(Configuration configuration)
{
    super(configuration);
}
 
Example #21
Source File: BatchedEmbedder.java    From vividus with Apache License 2.0 4 votes vote down vote up
public void setConfiguration(Configuration configuration)
{
    useConfiguration(configuration);
}
 
Example #22
Source File: IJBConfigurator.java    From colibri-ui with Apache License 2.0 votes vote down vote up
Configuration createConfig(); 
Example #23
Source File: IJBConfigurator.java    From colibri-ui with Apache License 2.0 votes vote down vote up
Configuration createConfig(ViewGenerator viewGenerator, Format... formats);