3

I need to implement JBehave test running with next requirements:

1. If @BeforeStories method is failed - test stories should not be started. For this I use Configuration MostUsefulConfiguration().doSkipScenariosAfterFailure(false)

2. If one scenario in story is failed - next scenario should be started. For this I use MostUsefulConfiguration().doResetStateBeforeStory(false).doResetStateBeforeScenario(false)

These settings work independently, but if I use it together - doSkipScenariosAfterFailure(false) discontinue working

How to implement this requirements at the same time?

If story file contains GivenStories: full.story then full.story still run even with doResetStateBeforeStory(false).doResetStateBeforeScenario(false)

I need to fix it also.

Test code:

@RunWith(JUnitReportingRunner.class)
public abstract class AbstractIntegrationTestStory extends JUnitStory {

    @BeforeStories
    public void beforeStories() throws ExecutionException {
        assertTrue(false);
    }

    ...

    @Override
    public Configuration configuration() {
        return JBehaveTestHelper.configuration(this.getClass(), xref);
    }
}

...

public class JBehaveTestHelper {

  public static Configuration configuration(Class<? extends Embeddable> embeddableClass, CrossReference xref) {

      return new MostUsefulConfiguration()
            .doSkipScenariosAfterFailure(false)
            .doResetStateBeforeStory(false)
            .doResetStateBeforeScenario(false)
}
Sergii Tanchenko
  • 702
  • 6
  • 18

0 Answers0