本文整理汇总了Java中org.jbehave.core.configuration.Keywords类的典型用法代码示例。如果您正苦于以下问题:Java Keywords类的具体用法?Java Keywords怎么用?Java Keywords使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Keywords类属于org.jbehave.core.configuration包,在下文中一共展示了Keywords类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConfiguration
import org.jbehave.core.configuration.Keywords; //导入依赖的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);
}
示例2: translate
import org.jbehave.core.configuration.Keywords; //导入依赖的package包/类
public Step translate(String step) {
String[] stepParts = split(step, " ", 2);
String keyword = stepParts[0];
String stepName = stepParts[1];
ExamplesTableFactory tableFactory = new ExamplesTableFactory();
Keywords keywords = new Keywords();
List<DataTableRow> tableData;
if (stepName.contains(keywords.examplesTableHeaderSeparator())) {
String[] parts = split(stepName, keywords.examplesTableHeaderSeparator(), 2);
stepName = parts[0];
ExamplesTable examplesTable = tableFactory.createExamplesTable(parts[1]);
tableData = translateDataTable(examplesTable);
} else {
tableData = noTableData();
}
return new Step(noComments(), keyword, " " + stepName, 1, tableData, null);
}
示例3: shouldBuildConfigurationFromAnnotations
import org.jbehave.core.configuration.Keywords; //导入依赖的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));
}
示例4: PlayersCanHazTurns
import org.jbehave.core.configuration.Keywords; //导入依赖的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());
}
示例5: shouldBuildConfigurationFromAnnotations
import org.jbehave.core.configuration.Keywords; //导入依赖的package包/类
@Test
public void shouldBuildConfigurationFromAnnotations() {
AnnotationBuilder builder = new GuiceAnnotationBuilder(AnnotatedUsingGuice.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"));
assertThatCustomObjectIsConverted(configuration.parameterConverters());
assertThatDateIsConvertedWithFormat(configuration.parameterConverters(), new SimpleDateFormat("yyyy-MM-dd"));
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));
}
示例6: shouldBuildConfigurationFromAnnotations
import org.jbehave.core.configuration.Keywords; //导入依赖的package包/类
@Test
public void shouldBuildConfigurationFromAnnotations() {
PicoAnnotationBuilder builder = new PicoAnnotationBuilder(AnnotatedUsingPico.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.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));
}
示例7: runScenariosParametrisedByExamples
import org.jbehave.core.configuration.Keywords; //导入依赖的package包/类
private void runScenariosParametrisedByExamples(RunContext context, Scenario scenario, Meta storyAndScenarioMeta)
throws Throwable {
ExamplesTable table = scenario.getExamplesTable();
reporter.get().beforeExamples(scenario.getSteps(), table);
Keywords keywords = context.configuration().keywords();
for (Map<String, String> scenarioParameters : table.getRows()) {
Meta parameterMeta = parameterMeta(keywords, scenarioParameters);
if ( !parameterMeta.isEmpty() && !context.filter.allow(parameterMeta) ){
continue;
}
reporter.get().example(scenarioParameters);
if (context.configuration().storyControls().resetStateBeforeScenario()) {
context.resetState();
}
runBeforeOrAfterScenarioSteps(context, scenario, storyAndScenarioMeta, Stage.BEFORE, ScenarioType.EXAMPLE);
addMetaParameters(scenarioParameters, storyAndScenarioMeta);
runGivenStories(scenario.getGivenStories(), scenarioParameters, context);
runScenarioSteps(context, scenario, scenarioParameters);
runBeforeOrAfterScenarioSteps(context, scenario, storyAndScenarioMeta, Stage.AFTER, ScenarioType.EXAMPLE);
}
reporter.get().afterExamples();
}
示例8: shouldNotMatchOrIgnoreStepWhenStartingWordNotFound
import org.jbehave.core.configuration.Keywords; //导入依赖的package包/类
@Test
public void shouldNotMatchOrIgnoreStepWhenStartingWordNotFound() throws Exception {
Method method = SomeSteps.class.getMethod("aMethod");
Keywords keywords = new LocalizedKeywords(){
@Override
public String startingWordFor(StepType stepType) {
throw new StartingWordNotFound(stepType, new HashMap<StepType, String>());
}
};
StepCandidate candidate = new StepCandidate("windows on the $nth floor", 0, WHEN, method, null, null, keywords,
new RegexPrefixCapturingPatternParser(), new ParameterConverters(), new ParameterControls());
assertThat(candidate.matches("When windows on the 1st floor"), is(false));
assertThat(candidate.ignore("!-- windows on the 1st floor"), is(false));
}
示例9: ensureKeywordsAreLocalisedFor
import org.jbehave.core.configuration.Keywords; //导入依赖的package包/类
private void ensureKeywordsAreLocalisedFor(Locale locale, String bundleName) throws IOException {
Keywords keywords = keywordsFor(locale, bundleName, null);
Properties properties = bundleFor(locale);
ensureKeywordIs(properties, META, keywords.meta());
ensureKeywordIs(properties, META_PROPERTY, keywords.metaProperty());
ensureKeywordIs(properties, NARRATIVE, keywords.narrative());
ensureKeywordIs(properties, IN_ORDER_TO, keywords.inOrderTo());
ensureKeywordIs(properties, AS_A, keywords.asA());
ensureKeywordIs(properties, I_WANT_TO, keywords.iWantTo());
ensureKeywordIs(properties, SCENARIO, keywords.scenario());
ensureKeywordIs(properties, GIVEN_STORIES, keywords.givenStories());
ensureKeywordIs(properties, EXAMPLES_TABLE, keywords.examplesTable());
ensureKeywordIs(properties, EXAMPLES_TABLE_ROW, keywords.examplesTableRow());
ensureKeywordIs(properties, EXAMPLES_TABLE_HEADER_SEPARATOR, keywords.examplesTableHeaderSeparator());
ensureKeywordIs(properties, EXAMPLES_TABLE_VALUE_SEPARATOR, keywords.examplesTableValueSeparator());
ensureKeywordIs(properties, EXAMPLES_TABLE_IGNORABLE_SEPARATOR, keywords.examplesTableIgnorableSeparator());
ensureKeywordIs(properties, GIVEN, keywords.given());
ensureKeywordIs(properties, WHEN, keywords.when());
ensureKeywordIs(properties, THEN, keywords.then());
ensureKeywordIs(properties, AND, keywords.and());
ensureKeywordIs(properties, IGNORABLE, keywords.ignorable());
ensureKeywordIs(properties, PENDING, keywords.pending());
ensureKeywordIs(properties, NOT_PERFORMED, keywords.notPerformed());
ensureKeywordIs(properties, FAILED, keywords.failed());
}
示例10: shouldBuildConfigurationFromAnnotations
import org.jbehave.core.configuration.Keywords; //导入依赖的package包/类
@Test
public void shouldBuildConfigurationFromAnnotations() {
AnnotationBuilder builder = createBuilder(AnnotatedUsingWeld.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"));
assertThatCustomObjectIsConverted(configuration.parameterConverters());
assertThatDateIsConvertedWithFormat(configuration.parameterConverters(), new SimpleDateFormat("yyyy-MM-dd"));
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));
}
示例11: shouldAllowUseOfGettersAndSetters
import org.jbehave.core.configuration.Keywords; //导入依赖的package包/类
@Test
public void shouldAllowUseOfGettersAndSetters(){
SpringStoryReporterBuilder builder = new SpringStoryReporterBuilder();
URL codeLocation = CodeLocations.codeLocationFromClass(this.getClass());
builder.setCodeLocation(codeLocation);
assertThat(builder.getCodeLocation(), equalTo(codeLocation));
List<Format> formats = asList(Format.CONSOLE, Format.HTML);
builder.setFormats(formats);
assertThat(builder.getFormats(), equalTo(formats));
Keywords keywords = new LocalizedKeywords();
builder.setKeywords(keywords);
assertThat(builder.getKeywords(), equalTo(keywords));
String relativeDirectory = "reports";
builder.setRelativeDirectory(relativeDirectory);
assertThat(builder.getRelativeDirectory(), equalTo(relativeDirectory));
assertThat(builder.getOutputDirectory(), endsWith(relativeDirectory));
Properties viewResources = new Properties();
builder.setViewResources(viewResources);
assertThat(builder.getViewResources(), equalTo(viewResources));
boolean reportFailureTrace = true;
builder.setReportFailureTrace(reportFailureTrace);
assertThat(builder.isReportFailureTrace(), equalTo(reportFailureTrace));
FilePathResolver pathResolver = new FileConfiguration().getPathResolver();
builder.setPathResolver(pathResolver);
assertThat(builder.getPathResolver(), equalTo(pathResolver));
}
示例12: StepCandidate
import org.jbehave.core.configuration.Keywords; //导入依赖的package包/类
public StepCandidate(String patternAsString, int priority, StepType stepType, Method method, Class<?> stepsType,
InjectableStepsFactory stepsFactory, Keywords keywords, StepPatternParser stepPatternParser,
ParameterConverters parameterConverters, ParameterControls parameterControls) {
this.patternAsString = patternAsString;
this.priority = priority;
this.stepType = stepType;
this.method = method;
this.stepsType = stepsType;
this.stepsFactory = stepsFactory;
this.keywords = keywords;
this.stepMatcher = stepPatternParser.parseStep(stepType, patternAsString);
this.stepCreator = new StepCreator(stepsType, stepsFactory, parameterConverters, parameterControls,
stepMatcher, stepMonitor);
}
示例13: createMeta
import org.jbehave.core.configuration.Keywords; //导入依赖的package包/类
public static Meta createMeta(String meta, Keywords keywords) {
List<String> properties = new ArrayList<String>();
for (String property : meta.split(keywords.metaProperty())) {
if (StringUtils.isNotBlank(property)) {
String beforeIgnorable = StringUtils.substringBefore(property,keywords.ignorable());
if ( StringUtils.isNotBlank(beforeIgnorable)){
properties.add(beforeIgnorable);
}
}
}
return new Meta(properties);
}
示例14: ExamplesTableFactory
import org.jbehave.core.configuration.Keywords; //导入依赖的package包/类
public ExamplesTableFactory(Keywords keywords, ResourceLoader resourceLoader,
ParameterConverters parameterConverters, TableTransformers tableTranformers) {
this.keywords = keywords;
this.resourceLoader = resourceLoader;
this.parameterConverters = parameterConverters;
this.tableTransformers = tableTranformers;
}
示例15: parameterMeta
import org.jbehave.core.configuration.Keywords; //导入依赖的package包/类
private Meta parameterMeta(Keywords keywords,
Map<String, String> scenarioParameters) {
String meta = keywords.meta();
if (scenarioParameters.containsKey(meta)) {
return Meta.createMeta(scenarioParameters.get(meta), keywords);
}
return Meta.EMPTY;
}