Why do you assume that each scenario must be atomic? There are use cases where do you'd want to keep state between scenarios.

You can certainly implement before/after procedures but there is no default behaviour to reset the instance variables. It would imply some sort of convention - which is difficult to generalise.

Apart from the code-level annotations @{Before|After}{Scenario/Story/Stories}, you can also use the lifecycle syntax in the story itself.

http://jbehave.org/reference/stable/story-syntax.html

On 25/02/2016 18:36, [email protected] wrote:

I am trying JBehave and I need to understand why maintains data (instance variables from the steps) across scenarios (testCases -> Given/When/Then).

I mean, is it possible to clear the instance variable maintained during the execution of each scenario (Given/When/Then) without using @BeforeScensario?

Example:

public class GenerateReportSteps {

|privateStringa;privateStringb;privateStringc;@BeforeScenariopublicvoidbeforeEachScenario(){a =null;b =null;c =null;}|

.. .. }

If I'm not wrong, I understand that each scenario (Given/When/Then) have to be atomic, so the framework JBehave should initialize to null the instance variables before run each scenario per user story.

Thanks.-

--
You received this message because you are subscribed to the Google Groups "JBehave Dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>. To view this discussion on the web, visit https://groups.google.com/d/msgid/jbehave-dev/43b7d829-7d63-4995-9382-3c38a5d6dd1e%40googlegroups.com <https://groups.google.com/d/msgid/jbehave-dev/43b7d829-7d63-4995-9382-3c38a5d6dd1e%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "JBehave 
Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/jbehave-dev/56CF477E.2040802%40aquilonia.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to