Hello All,

I am just curious on how the jBehave community decides when and where to
use GivenStories and Composite Steps, in order to set a best practice for
my team...

At least there seems to be some confusion in my team about where and when
to use either GivenStories or a composite steps (@Composite annotation)
(ie. some think its good to only use only GivenStories and others only want
to group every test case into a composite step)

My personal belief is that Composite Steps are there solely to provide a
declarative semantics, over that of imperative semantics of a block of
steps...

And that GivenStories are there to allow a Software Engineer in Test to
reuse isolated story files as preconditions in their stories...

And that both should be used given some best practices...

Hence a best practice I was thinking would be the following:
- CompositeSteps should only be used when attempting to provide a
declarative step for the dsl layer, only after all imperative steps have
been written for the corresponding page object
- Do not create composite steps for items that will not benefit the
readability of the step (too many parameters can hurt the readability of a
step, use GivenStories here)
- Do not create composite steps for every one off test case, only create
when you have a high impact for re-usability
- Do not restrict the use of CompositeSteps to a precondition (@Given), as
it can be used to group actions (@When) or post-conditions (@Then) as well
- Stories called by GivenStories should be isolated (otherwise you may end
up having to manage the dependencies, ie story C uses story B uses story A
uses etc...)
- GivenStories should be used when there is a complex set of preconditions
for a story

Are my thoughts wrong or do you have some best practices to add or share
regarding when to use these features?

Cheers,
:Paul

Reply via email to