Hi Jorge,

I hope i understood your problem well.
Why don't u just say:

Scenario: User logs in and perform action A
Given Stories: baseLogin.story

Some action A steps

Scenario: Lodged on user can also perform action B

Some action B steps

....and so on

I somehow had/have similar problems caused by the fact that is not quite easy 
to control what to run before all scenarios from that story (so before the 
story) and what do I need to run before each scenario. Such a feature would 
really be handy.

Cheers,
Julian


--- On Thu, 28/6/12, Mauro Talevi <[email protected]> wrote:

From: Mauro Talevi <[email protected]>
Subject: Re: [jbehave-user] Story level GivenStories
To: "[email protected]" <[email protected]>
Received: Thursday, 28 June, 2012, 5:32 PM

Hi, 
You are right.  GivenStories apply to a scenario, but to satisfy your usecase 
you need only define a first scenario with your desired given story. 

We can discuss the pros and cons of adding it to story level as standalone. 
Cheers
On 28 Jun 2012, at 03:07, Jorge Pombar <[email protected]> wrote:




 
 










From my testing it seems like GivenStories can only be used
at the Scenario level and not at the Story level. Is this correct? 

   

If so, I’m a little stuck on my use case. I’m
testing a webApp and the first thing every Scenario need to do is log in. Hence
I have a “baseLogin.story” that my scenarios use to log in.
However, if I call this for every scenario it doesn’t work because once
you log in once if the session is still open the next time you are taken to the
login page directly so the second scenario on the story fails when the 
GivenStory
tries to execute for the second time. 

   

I was hoping to be able to use “GivenStories” at
the story level. In this case the GivenStory will execute only once at the 
beginning
of any scenario and then all the scenarios in the story will execute. 

   

I was also thinking that I have the option of logging out
after every scenario (don’t like because is very inefficient) or write code
that detects if I’m logged in at the “baseLogin.story” level
(seems bulky and wasteful). Is there a more elegant/proper way I’m missing? 

   

Thanks
in advance of the help, 

Enrique 

   






Reply via email to