本文整理汇总了Java中org.jbehave.core.reporters.StoryReporterBuilder类的典型用法代码示例。如果您正苦于以下问题:Java StoryReporterBuilder类的具体用法?Java StoryReporterBuilder怎么用?Java StoryReporterBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StoryReporterBuilder类属于org.jbehave.core.reporters包,在下文中一共展示了StoryReporterBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCreateShouldCreateConfiguration
import org.jbehave.core.reporters.StoryReporterBuilder; //导入依赖的package包/类
@Test
public void testCreateShouldCreateConfiguration() {
//GIVEN
JBehaveTestCase testCase = new JBehaveTestCase() {
@Override
protected String getStoryPath() {
return "something";
}
};
GherkinStoryParser gherkinStoryParser = new GherkinStoryParser();
StoryReporterBuilder storyReporterBuilder = new StoryReporterBuilder().withReporters(new JBehaveStoryReporter(testCase));
FailingUponPendingStep pendingStepStrategy = new FailingUponPendingStep();
given(storyParserFactory.createGherkinStoryParser()).willReturn(gherkinStoryParser);
given(pendingStepStrategyFactory.createFailingUponPendingStep()).willReturn(pendingStepStrategy);
given(storyReporterBuilderFactory.createForTestCase(testCase)).willReturn(storyReporterBuilder);
//WHEN
Configuration result = underTest.create(testCase);
//THEN
assertEquals(gherkinStoryParser, result.storyParser());
assertEquals(pendingStepStrategy, result.pendingStepStrategy());
assertEquals(storyReporterBuilder, result.storyReporterBuilder());
}
示例2: configuration
import org.jbehave.core.reporters.StoryReporterBuilder; //导入依赖的package包/类
@Override
public Configuration configuration() {
return new MostUsefulConfiguration()
// 找和java相同路徑的Story
.useStoryLoader(new LoadFromClasspath(this.getClass()))
// 設定Story行為檔佮JUnit設定檔的檔名對應
.useStoryPathResolver(new CasePreservingResolver())
// 有Step沒定義到視同Error
.usePendingStepStrategy(new FailingUponPendingStep())
// CONSOLE和TXT報表
.useStoryReporterBuilder(
new StoryReporterBuilder().withDefaultFormats().withFormats(
Format.CONSOLE,
Format.TXT
)
);
}
示例3: getConfiguration
import org.jbehave.core.reporters.StoryReporterBuilder; //导入依赖的package包/类
@Produces
@Singleton
@ConfigurationAlternative
@WeldConfiguration
public Configuration getConfiguration()
{
LOG.info("ConfigurationProducer.getConfiguration()");
Keywords keywords = new LocalizedKeywords();
ParameterConverters converters = new ParameterConverters().addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")), new StoryParameterEnumConverter());
return new MostUsefulConfiguration().useStoryControls(new StoryControls().doDryRun(runConfig.doDryRun()).doSkipScenariosAfterFailure(false))
.useStepPatternParser(new RegexPrefixCapturingPatternParser()).useStoryLoader(new LoadFromClasspath(this.getClass().getClassLoader()))
.useKeywords(keywords).useStepCollector(new MarkUnmatchedStepsAsPending(keywords)).useStoryParser(new RegexStoryParser(keywords, new ExamplesTableFactory(keywords, new LoadFromClasspath(this.getClass()), converters))).useDefaultStoryReporter(new ConsoleOutput(keywords))
.useStoryReporterBuilder(new StoryReporterBuilder().withFormats(Format.CONSOLE, Format.TXT, Format.STATS, WebDriverHtmlOutputWithImg.WEB_DRIVER_HTML_WITH_IMG).withFailureTrace(true).withReporters(new LoggingStoryReporter()).withKeywords(keywords)).useParameterConverters(converters);
}
示例4: PortalStories
import org.jbehave.core.reporters.StoryReporterBuilder; //导入依赖的package包/类
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));
}
示例5: configuration
import org.jbehave.core.reporters.StoryReporterBuilder; //导入依赖的package包/类
@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);
}
示例6: configuration
import org.jbehave.core.reporters.StoryReporterBuilder; //导入依赖的package包/类
/**
* <p>
* Configuration de l'environnement d'exécution de JBehave :
* <ul>
* <li>CONSOLE : sortie des rapports en console pour facilitrer la phase de
* développement dans l'IDE</li>
* <li>HTML_TEMPLATE : génération de rapports HTML pour une meilleure
* lisibilité au niveau de la PIC</li>
* <li>Stratégie transmise à useStepMonitor() :
* <ul>
* <li>Par défaut : stratégie qui veut que les étapes du test à PENDING
* soient ignorées, ainsi le test passe.</li>
* <li>new FailingUponPendingStep() : stratégie qui veut que les étapes du
* test à PENDING fassent échouer le test.</li>
* </ul>
* </li>
* </ul>
* </p>
*/
@Override
public Configuration configuration() {
Class<? extends Embeddable> embeddableClass = this.getClass();
URL codeLocation = codeLocationFromClass(embeddableClass);
StoryReporterBuilder storyReporter = //
new StoryReporterBuilder() //
.withCodeLocation(codeLocation) //
.withDefaultFormats() //
.withFormats(CONSOLE, //
HTML_TEMPLATE) //
.withFailureTrace(true) //
.withFailureTraceCompression(true) //
.withCrossReference(xref);
return new MostUsefulConfiguration() //
.useStoryLoader(new UTF8StoryLoader(embeddableClass)) //
.useStoryReporterBuilder(storyReporter) //
.usePendingStepStrategy(new FailingUponPendingStep()) //
.useStepMonitor(xref.getStepMonitor());
}
示例7: configuration
import org.jbehave.core.reporters.StoryReporterBuilder; //导入依赖的package包/类
@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);
}
示例8: configuration
import org.jbehave.core.reporters.StoryReporterBuilder; //导入依赖的package包/类
@Override
public Configuration configuration() {
LoadFromClasspath storyLoader = new LoadFromClasspath(this.getClass());
URL codeLocation = codeLocationFromClass(this.getClass());
// TODO test ANSI_CONSOLE and IDE_CONSOLE format
StoryReporterBuilder reporterBuilder = new StoryReporterBuilder()
.withCodeLocation(codeLocation)
.withDefaultFormats()
.withFormats(CONSOLE, TXT, HTML, XML);
Configuration config = new MostUsefulConfiguration()
.useStoryLoader(storyLoader)
.useStoryReporterBuilder(reporterBuilder);
return config;
}
示例9: configuration
import org.jbehave.core.reporters.StoryReporterBuilder; //导入依赖的package包/类
@Override
public Configuration configuration() {
Class<? extends Embeddable> embeddableClass = this.getClass();
Properties viewResources = new Properties();
viewResources.put("decorateNonHtml", "true");
return new MostUsefulConfiguration()
.useParanamer(paranamer)
.useStoryLoader(new LoadFromClasspath(embeddableClass))
.useStoryPathResolver(new UnderscoredCamelCaseResolver().removeFromClassName("Story"))
.useStoryReporterBuilder(new StoryReporterBuilder()
.withCodeLocation(CodeLocations.codeLocationFromClass(embeddableClass))
.withDefaultFormats()
.withPathResolver(new FilePrintStreamFactory.ResolveToPackagedName())
.withViewResources(viewResources)
.withFormats(CONSOLE, TXT, HTML, XML))
.useParameterConverters(new ParameterConverters()
.addConverters(new ParameterConverters.NumberConverter(), new DateConverter(new SimpleDateFormat("yyyy-MM-dd")))) // use custom date pattern
.useStepPatternParser(new RegexPrefixCapturingPatternParser(
"$")) // use '%' instead of '$' to identify parameters
.useStepMonitor(new SilentStepMonitor());
}
示例10: InvoiceStories
import org.jbehave.core.reporters.StoryReporterBuilder; //导入依赖的package包/类
public InvoiceStories() {
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(InvoiceStories.class)).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(InvoiceStories.class))
.useStoryReporterBuilder(reporterBuilder);
useConfiguration(configuration);
ApplicationContext context = new SpringApplicationContextFactory("invoice-steps.xml").createApplicationContext();
useStepsFactory(new SpringStepsFactory(configuration, context));
}
示例11: runStories
import org.jbehave.core.reporters.StoryReporterBuilder; //导入依赖的package包/类
private void runStories(String... storyPaths) {
StoryReporterBuilder storyReporterBuilder = new StoryReporterBuilder().withDefaultFormats()
.withCodeLocation(CodeLocations.codeLocationFromClass(ReportTransformBehaviour.class))
.withFormats(Format.XML);
Configuration configuration = new MostUsefulConfiguration()
.useStoryLoader(new LoadFromClasspath(this.getClass())).useStoryReporterBuilder(storyReporterBuilder)
.useFailureStrategy(new SilentlyAbsorbingFailure())
.useStepCollector(new MarkUnmatchedStepsAsPending(new StepFinder(new ByLevenshteinDistance())));
Embedder embedder = new Embedder();
embedder.useEmbedderControls(new EmbedderControls().doGenerateViewAfterStories(false));
embedder.useConfiguration(configuration);
embedder.useCandidateSteps(new InstanceStepsFactory(configuration, new MySteps()).createCandidateSteps());
embedder.useMetaFilters(asList("-skip true"));
try {
embedder.runStoriesAsPaths(asList(storyPaths));
} catch (Exception e) {
e.printStackTrace();
}
}
示例12: configuration
import org.jbehave.core.reporters.StoryReporterBuilder; //导入依赖的package包/类
@Override
public Configuration configuration() {
Class<? extends TraderEmbedder> embedderClass = this.getClass();
return new MostUsefulConfiguration()
.useStoryLoader(new LoadFromClasspath(embedderClass.getClassLoader()))
.useStoryReporterBuilder(new StoryReporterBuilder()
.withCodeLocation(CodeLocations.codeLocationFromClass(embedderClass))
.withDefaultFormats()
.withFormats(CONSOLE, TXT, HTML, XML)
.withCrossReference(new CrossReference()))
.useParameterConverters(new ParameterConverters()
.addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")))) // use custom date pattern
.useStepPatternParser(new RegexPrefixCapturingPatternParser(
"%")) // use '%' instead of '$' to identify parameters
.useStepMonitor(new SilentStepMonitor());
}
示例13: configuration
import org.jbehave.core.reporters.StoryReporterBuilder; //导入依赖的package包/类
@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);
}
示例14: PlayersCanHazTurns
import org.jbehave.core.reporters.StoryReporterBuilder; //导入依赖的package包/类
public PlayersCanHazTurns() {
ClassLoader classLoader = this.getClass().getClassLoader();
URL codeLocation = CodeLocations.codeLocationFromClass(this.getClass());
Keywords keywords = new LocalizedKeywords(new Locale("lc"),
"i18n/keywords", classLoader);
Configuration configuration = new MostUsefulConfiguration()
.useKeywords(keywords)
.useStoryParser(new RegexStoryParser(keywords))
.useStoryPathResolver(new UnderscoredCamelCaseResolver(""))
.useStoryReporterBuilder(new StoryReporterBuilder()
.withCodeLocation(codeLocation)
.withDefaultFormats()
.withFormats(CONSOLE, TXT)
.withFailureTrace(true)
.withKeywords(keywords));
useConfiguration(configuration);
WindowControl windowControl = new WindowControl();
addSteps(new InstanceStepsFactory(configuration, new LolCatzSteps(windowControl), new BeforeAndAfterSteps(windowControl)).createCandidateSteps());
}
示例15: configure
import org.jbehave.core.reporters.StoryReporterBuilder; //导入依赖的package包/类
@Override
protected void configure() {
bind(StoryControls.class).toInstance(new StoryControls().doDryRun(true).doSkipScenariosAfterFailure(true));
bind(FailureStrategy.class).to(SilentlyAbsorbingFailure.class);
bind(StepPatternParser.class).toInstance(new RegexPrefixCapturingPatternParser("MyPrefix"));
bind(StoryLoader.class).toInstance(new LoadFromURL());
Properties viewResources = new Properties();
viewResources.setProperty("index", "my-reports-index.ftl");
viewResources.setProperty("decorateNonHtml", "true");
bind(StoryReporterBuilder.class).toInstance(
new StoryReporterBuilder().withDefaultFormats().withFormats(CONSOLE, HTML, TXT, XML).withKeywords(
new LocalizedKeywords(Locale.ITALIAN)).withRelativeDirectory("my-output-directory")
.withViewResources(viewResources).withFailureTrace(true));
Multibinder<ParameterConverter> multiBinder = Multibinder.newSetBinder(binder(), ParameterConverter.class);
multiBinder.addBinding().toInstance(new CustomConverter());
multiBinder.addBinding().toInstance(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")));
}