Pre- and postcondition per scenario @BeforeScenario @AfterStory etc. in story description

Description

Problem:
The different ways to define a single scenario and its logic makes it hard to understand test logic.

Example:
I have two test suites calles RegistrationProcessStory ond AccountingStory.

The RegistrationProcessStory is a jbehave story containing logic for test data preparation like BeforeStory, AfterStory and BeforeScenario(onOutcome=Failure) etc.

The AccountingStory contains similar test data logic.

A Given statement is something like a BeforeScenario (i.e. @BeforeScenario(uponType = ScenarioType.EXAMPLE)).

So my problem is, that we have test data preparation logic in a .story file. but we could have another logic hidden in the implementation of a testsuite. (@BeforeScenario) On the other hand, test cleanup logic can't be described in a .story file, but in the TestSuite logic (@AfterScenario, @AfterStory)

Solution:
I would like to have an extension to the BDD vocabulary, that enables pre- and postcondition descriptions in a .story file.

This could be a simple mapping of the annotations to a keyword like:

Scenario: User is operator by default
BeforeScenario create user <login> with data <dataentries>
Given user <login> on login page
Then ensure operator link is visible
AfterScenario delete user <login>

What do you think about the idea?

Greetings, Olmo

Activity

Show:

Mauro Talevi April 21, 2018 at 4:17 PM

Now supported by lifecyle element in story:

http://jbehave.org/reference/stable/lifecycle.html

Fixed

Details

Assignee

Reporter

Labels

Fix versions

Priority

Created September 5, 2012 at 1:06 PM
Updated January 18, 2021 at 6:26 PM
Resolved April 21, 2018 at 4:17 PM