【问题标题】:Not able to skip scenarios in Jbehave with JunitStory无法使用 JunitStory 跳过 Jbehave 中的场景
【发布时间】: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 的绑定方法都存在。

【问题讨论】:

    标签: bdd jbehave


    【解决方案1】:

    得到 jbehave 开发组的回复 - 出现语法错误 我做了 元:@skip 但它应该是 元:@skip

    【讨论】:

      【解决方案2】:

      我在我的 jbehave 场景中像这样使用了@ignore,它起作用了。

      Scenario: Employee1 - Delete Employees
      Meta:
      @ignore
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2023-03-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多