private StoryReporterBuilder storyReporterBuilder() {
     return new StoryReporterBuilder()
             .withCodeLocation(CodeLocations.codeLocationFromClass(this.getClass()))
             .withPathResolver(new ResolveToPackagedName())
             .withFailureTrace(true)
             .withDefaultFormats()
             .withFormats(IDE_CONSOLE, TXT, HTML);
 }
 @Override
 protected List<String> storyPaths() {
   return new StoryFinder()
       .findPaths(
           CodeLocations.codeLocationFromPath("src/test/resources"),
           "**/*.story",
           "**/exclude_*.story");
 }
 @Override
 public List<String> storyPaths() {
   return new StoryFinder()
       .findPaths(
           CodeLocations.codeLocationFromClass(getClass()),
           asList("**/" + testsFolder + "/**/*.story"),
           asList(""));
 }
  @Override
  public Configuration configuration() {

    final Configuration configuration = new MostUsefulConfiguration();
    configuration.useStoryReporterBuilder(
        new RichReporterBuilder()
            .withCodeLocation(CodeLocations.codeLocationFromClass(getClass())));
    configuration.useStepMonitor(new PrintStreamStepMonitor());
    configuration.usePendingStepStrategy(new FailingUponPendingStep());
    configuration.useStepdocReporter(new PrintStreamStepdocReporter());

    return configuration;
  }
  private Configuration seleniumConfiguration(
      Class<?> embeddableClass, WebDriverProvider driverProvider) {

    StoryReporterBuilder storyReporterBuilder =
        new StoryReporterBuilder()
            .withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass))
            .withFailureTrace(true)
            .withFailureTraceCompression(true)
            .withDefaultFormats()
            .withFormats(outputFormats)
            .withCrossReference(crossReference);
    addCrossReference(storyReporterBuilder, crossReference);

    return new SeleniumConfiguration()
        .useWebDriverProvider(driverProvider)
        .useSeleniumContext(seleniumContext)
        .useFailureStrategy(new FailingUponPendingStep())
        .useStepMonitor(createStepMonitor())
        .useStoryLoader(new LoadFromClasspath(embeddableClass.getClassLoader()))
        .useStoryReporterBuilder(storyReporterBuilder);
  }
  public PreferredConfiguration(String storyUrl) {
    URL codeLocation = CodeLocations.codeLocationFromURL(storyUrl);
    Properties viewResources = new Properties();
    StoryPathResolver storyPathResolver = new UnderscoredCamelCaseResolver(".story");
    StoryReporterBuilder srb =
        new StoryReporterBuilder()
            .withDefaultFormats()
            .withViewResources(viewResources)
            .withFormats(Format.XML, Format.CONSOLE, Format.HTML, Format.IDE_CONSOLE, Format.TXT)
            .withFailureTrace(Config.displayStackTrace());

    // Setup parameters
    ParameterConverters parameterConverters =
        new ParameterConverters()
            .addConverters(
                new ExamplesTableConverter(
                    new ExamplesTableFactory(new LoadFromRelativeFile(codeLocation))));
    // factory to allow parameter conversion and loading from external
    // resources (used by StoryParser too)
    ExamplesTableFactory examplesTableFactory =
        new ExamplesTableFactory(
            new LocalizedKeywords(), new LoadFromRelativeFile(codeLocation), parameterConverters);
    // add custom coverters
    parameterConverters.addConverters(new ExamplesTableConverter(examplesTableFactory));
    viewResources.put("decorateNonHtml", "true");
    useStoryControls(
            new StoryControls()
                .doDryRun(false)
                .doSkipScenariosAfterFailure(false)
                .doResetStateBeforeStory(true)
                .useStoryMetaPrefix("story_")
                .useScenarioMetaPrefix("scenario_"))
        .useStoryLoader(new LoadFromRelativeFile(codeLocation))
        .useStoryReporterBuilder(srb)
        .useStoryPathResolver(storyPathResolver)
        .useStepMonitor(new SilentStepMonitor())
        .useStoryParser(new RegexStoryParser(examplesTableFactory))
        .useParameterConverters(parameterConverters);
  }
예제 #7
0
 @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 ExamplesTableConverter(examplesTableFactory));
   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);
 }