本文整理汇总了Java中org.jbehave.core.configuration.Configuration类的典型用法代码示例。如果您正苦于以下问题:Java Configuration类的具体用法?Java Configuration怎么用?Java Configuration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Configuration类属于org.jbehave.core.configuration包,在下文中一共展示了Configuration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCreateShouldCreateConfiguration
import org.jbehave.core.configuration.Configuration; //导入依赖的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.configuration.Configuration; //导入依赖的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.configuration.Configuration; //导入依赖的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.configuration.Configuration; //导入依赖的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.configuration.Configuration; //导入依赖的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.configuration.Configuration; //导入依赖的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.configuration.Configuration; //导入依赖的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.configuration.Configuration; //导入依赖的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.configuration.Configuration; //导入依赖的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: buildConfiguration
import org.jbehave.core.configuration.Configuration; //导入依赖的package包/类
@Override
public Configuration buildConfiguration() throws AnnotationRequired {
if (annotationFinder().isAnnotationPresent(UsingSpring.class)) {
List<String> resources = annotationFinder()
.getAnnotatedValues(UsingSpring.class, String.class, "resources");
if (resources.size() > 0) {
try {
context = createApplicationContext(annotatedClass().getClassLoader(), resources);
} catch (Exception e) {
annotationMonitor().elementCreationFailed(ApplicationContext.class, e);
}
}
} else {
annotationMonitor().annotationNotFound(UsingSpring.class, annotatedClass());
}
return super.buildConfiguration();
}
示例11: shouldBuildConfigurationFromAnnotations
import org.jbehave.core.configuration.Configuration; //导入依赖的package包/类
@Test
public void shouldBuildConfigurationFromAnnotations() {
SpringAnnotationBuilder builder = new SpringAnnotationBuilder(AnnotatedUsingSpring.class);
Configuration configuration = builder.buildConfiguration();
assertThat(configuration.storyControls().dryRun(), is(true));
assertThat(configuration.storyControls().skipScenariosAfterFailure(), is(true));
assertThat(configuration.failureStrategy(), instanceOf(SilentlyAbsorbingFailure.class));
assertThat(configuration.storyLoader(), instanceOf(LoadFromURL.class));
assertThat(configuration.stepPatternParser(), instanceOf(RegexPrefixCapturingPatternParser.class));
assertThat(((RegexPrefixCapturingPatternParser) configuration.stepPatternParser()).getPrefix(),
equalTo("MyPrefix"));
assertThatDateIsConvertedWithFormat(configuration.parameterConverters(), new SimpleDateFormat("yyyy-MM-dd"));
assertThat(configuration.parameterControls().nameDelimiterLeft(), equalTo("["));
assertThat(configuration.parameterControls().nameDelimiterRight(), equalTo("]"));
assertThat(configuration.storyReporterBuilder().formats(), hasItems(CONSOLE, HTML, TXT, XML, STATS));
Keywords keywords = configuration.storyReporterBuilder().keywords();
assertThat(keywords, instanceOf(LocalizedKeywords.class));
assertThat(((LocalizedKeywords) keywords).getLocale(), equalTo(Locale.ITALIAN));
assertThat(configuration.storyReporterBuilder().outputDirectory().getName(), equalTo("my-output-directory"));
assertThat(configuration.storyReporterBuilder().viewResources().getProperty("index"),
equalTo("my-reports-index.ftl"));
assertThat(configuration.storyReporterBuilder().viewResources().getProperty("decorateNonHtml"), equalTo("true"));
assertThat(configuration.storyReporterBuilder().reportFailureTrace(), is(true));
}
示例12: runStories
import org.jbehave.core.configuration.Configuration; //导入依赖的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();
}
}
示例13: configuration
import org.jbehave.core.configuration.Configuration; //导入依赖的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());
}
示例14: configuration
import org.jbehave.core.configuration.Configuration; //导入依赖的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);
}
示例15: PlayersCanHazTurns
import org.jbehave.core.configuration.Configuration; //导入依赖的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());
}