本文整理汇总了Java中org.jbehave.core.configuration.MostUsefulConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java MostUsefulConfiguration类的具体用法?Java MostUsefulConfiguration怎么用?Java MostUsefulConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MostUsefulConfiguration类属于org.jbehave.core.configuration包,在下文中一共展示了MostUsefulConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
results = new AllureResultsWriterStub();
final AllureLifecycle lifecycle = new AllureLifecycle(results);
StepsAspects.setLifecycle(lifecycle);
AttachmentsAspects.setLifecycle(lifecycle);
embedder.useEmbedderControls(new EmbedderControls()
.doGenerateViewAfterStories(false)
.doVerboseFailures(true)
);
embedder.useConfiguration(new MostUsefulConfiguration()
.useStoryLoader(new LoadFromClasspath(this.getClass()))
.useStoryReporterBuilder(new ReportlessStoryReporterBuilder(folder.newFolder())
.withReporters(new AllureJbehave(lifecycle))
)
);
embedder.useCandidateSteps(new InstanceStepsFactory(embedder.configuration(), new StackSteps())
.createCandidateSteps()
);
}
示例2: configuration
import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的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.MostUsefulConfiguration; //导入依赖的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: configuration
import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的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);
}
示例5: configuration
import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的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());
}
示例6: configuration
import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的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);
}
示例7: configuration
import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的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;
}
示例8: configuration
import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的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());
}
示例9: runStories
import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的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();
}
}
示例10: configuration
import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的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());
}
示例11: configuration
import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的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);
}
示例12: PlayersCanHazTurns
import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的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());
}
示例13: assertThatStepsCanBeCreated
import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
@Test
public void assertThatStepsCanBeCreated() throws NoSuchFieldException, IllegalAccessException {
// Given
Injector parent = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(FooSteps.class).in(Scopes.SINGLETON);
}
});
AbstractStepsFactory factory = new GuiceStepsFactory(new MostUsefulConfiguration(), parent);
// When
List<CandidateSteps> steps = factory.createCandidateSteps();
// Then
assertFooStepsFound(steps);
}
示例14: assertThatStepsWithStepsWithDependencyCanBeCreated
import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
@Test
public void assertThatStepsWithStepsWithDependencyCanBeCreated() throws NoSuchFieldException, IllegalAccessException {
Injector parent = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(Integer.class).toInstance(42);
bind(FooStepsWithDependency.class).in(Scopes.SINGLETON);
}
});
// When
AbstractStepsFactory factory = new GuiceStepsFactory(new MostUsefulConfiguration(), parent);
List<CandidateSteps> steps = factory.createCandidateSteps();
// Then
assertFooStepsFound(steps);
assertEquals(42, (int) ((FooStepsWithDependency) stepsInstance(steps.get(0))).integer);
}
示例15: shouldAllowOverrideOfDefaultConfiguration
import org.jbehave.core.configuration.MostUsefulConfiguration; //导入依赖的package包/类
@Test
public void shouldAllowOverrideOfDefaultConfiguration() throws Throwable {
// Given
Embedder embedder = mock(Embedder.class);
Configuration configuration = mock(Configuration.class);
StoryPathResolver pathResolver = mock(StoryPathResolver.class);
when(embedder.configuration()).thenReturn(configuration);
when(configuration.storyPathResolver()).thenReturn(pathResolver);
Class<MyStory> storyClass = MyStory.class;
String storyPath = "/path/to/story";
when(pathResolver.resolve(storyClass)).thenReturn(storyPath);
CandidateSteps steps = mock(CandidateSteps.class);
// When
MyStory story = new MyStory(new MostUsefulConfiguration(), steps);
assertThat(story.configuration(), is(not(sameInstance(configuration))));
story.useConfiguration(configuration);
assertThat(story.configuration(), is(sameInstance(configuration)));
story.useEmbedder(embedder);
story.run();
// Then
verify(embedder).useConfiguration(configuration);
verify(embedder).useCandidateSteps(Mockito.eq(Arrays.asList(steps)));
verify(embedder).runStoriesAsPaths(asList(storyPath));
}