【发布时间】:2014-02-10 16:49:52
【问题描述】:
我一直在关注很多帖子和线程,基于这些帖子和线程已集成 跳过场景的逻辑。仍然无法使其成功运行。 当我把 "configuredEmbedder().useMetaFilters(Arrays.asList("-skip"));" 或者 "configuredEmbedder().useMetaFilters(Arrays.asList("+skip"));" 在 storyrunner,java 文件中,没有执行任何场景。 当我删除这条线时,所有的场景都被执行了。 我的 .story 文件在 4 个场景中的 2 个中有“元跳过”。 有人可以调查一下,让我知道我可能错过了什么。
下面是所有配置所在的类 公共类 SampleStory 扩展 JUnitStory {
public SampleStory() {
configuredEmbedder().embedderControls()
.doGenerateViewAfterStories(true)
.doIgnoreFailureInStories(false).doIgnoreFailureInView(true)
.useStoryTimeoutInSecs(60);
configuredEmbedder().useMetaFilters(Arrays.asList("+skip"));
/* removeStartIgnoreCase */
// StringUtils.removeStartIgnoreCase("","");
}
@Override
public Configuration configuration() {
Configuration configuration = new MostUsefulConfiguration();
Properties viewResources = new Properties();
viewResources.put("decorateNonHtml", "true");
viewResources.put("reports", "ftl/jbehave-reports-with-totals.ftl");
// Where to find the stories
StoryLoader storyLoader;
storyLoader = new LoadFromRelativeFile(
CodeLocations.codeLocationFromClass(this.getClass()));
configuration.useStoryLoader(storyLoader);
StoryReporterBuilder storyReporterBuilder;
storyReporterBuilder = new StoryReporterBuilder();
// storyReporterBuilder.withDefaultFormats();
storyReporterBuilder.withDefaultFormats();
// storyReporterBuilder.withViewResources(viewResources).withFormats(CONSOLE,
// TXT, HTML, XML);
// storyReporterBuilder.withFormats();
// CONSOLE reporting
configuration.useStoryReporterBuilder(storyReporterBuilder);
return configuration;
}
/*
* @Override public Embedder configuredEmbedder() {
* super.configuredEmbedder().useMetaFilters(Arrays.asList("-skip"));
*
*
* return super.configuredEmbedder(); }
*/
@Override
public InjectableStepsFactory stepsFactory() {
return new InstanceStepsFactory(configuration(), new SampleSteps());
}
Snenairo.story
Scenario: This is scenario 1
Given I say hello
When I say bye
Then whatever
Scenario: This is scenario 2
Meta : @skip
Given I say ello
When I say ye
Then whatever
还有一个类,其中所有 g/w/t 的绑定方法都存在。
【问题讨论】: