How to skip a particular scenario on Jbehave tests

2019-07-07 04:38发布

I have a particular scenario which is not ready for testing yet. So I need to skip it in order to run the tests on other scenarios.

Scenario: Login-success Scenario:

Meta:
@skip
@ignored true

//Regular Steps

2条回答
别忘想泡老子
2楼-- · 2019-07-07 05:13

You can simply skip the test using the @skip in the meta info:

Scenario:  A scenario which we cannot run every time due to some technical contraint
Meta:
@skip     
@ignored true  
Given ... // normal scenario steps

Documentation on meta tags can be found here

查看更多
Fickle 薄情
3楼-- · 2019-07-07 05:24

In order to use @skip or @ignore true meta in a story to skip this story,
you need to configure a meta filter in configuration of your test.

Depending on how you configure your test, it could be for example:

@RunWith(AnnotatedEmbedderRunner.class)
@UsingEmbedder(metaFilters = {"-skip"})
public class AnnotatedTraderEmbedder extends InjectableEmbedder {
} 

or, in Java:

public MyStories() {
    configuredEmbedder().embedderControls().doGenerateViewAfterStories(true)
        .doIgnoreFailureInStories(true)
        .doIgnoreFailureInView(true).useThreads(1); 
    // Meta filters:
    configuredEmbedder().useMetaFilters(Arrays.asList("-skip"));
}

See the documentation for details: http://jbehave.org/reference/stable/meta-filtering.html

查看更多
登录 后发表回答