Excellent, I would love for this feature to be added too. As Mauro said it would make the step visible and fully backwards compatible ☺
@Iulian I didn’t want to implement it that way because it would make scenarios dependant on other scenarios. However, you did give me the idea of having a standalone scenario at the top that always runs and has the GivenStory baseLogin.story. This fixed my problem Thanks everyone for the help! Enrique From: Iulian Greculescu [mailto:[email protected]] Sent: Thursday, June 28, 2012 3:26 PM To: [email protected] Subject: Re: [jbehave-user] Story level GivenStories >>having an optional GivenStories at story level as well as at scenario level To me that would be a very good to have feature. Not necessarily you will always have GivenStories at both Story and Scenario level (you could if you needed it) but because you have the flexibility to choose which way is more appropiate for your concrete situation. Cheers, --- 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] Received: Thursday, 28 June, 2012, 10:26 PM @Before and @After annotations are useful for technical tasks but have the drawbacks of not being visible to the business (nor to the team, at least not as visible). I think having an optional GivenStories at story level as well as at scenario level is possible and fully backward compatible. On 28/06/2012 14:19, Andreas Ebbert-Karroum wrote: Hi, what about having a method annotated with @BeforeStories or @BeforeScenario? Andreas 2012/6/28 Iulian Greculescu <[email protected]</mc/[email protected]>> 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]</mc/[email protected]>> wrote: From: Mauro Talevi <[email protected]</mc/[email protected]>> Subject: Re: [jbehave-user] Story level GivenStories To: "[email protected]</mc/[email protected]>" <[email protected]</mc/[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]<http://mc/[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 -- Mit freundlichen Grüßen / Best regards Andreas Ebbert-Karroum | Bereichsleiter der Agilen Software Factory codecentric AG | Merscheider Straße 1 | 42699 Solingen | Deutschland tel: +49 (0) 212.23362825 | fax: +49 (0) 212.23362879 | mobil: +49 (0) 175.2664109 www.codecentric.de<http://www.codecentric.de> | blog.codecentric.de<http://blog.codecentric.de> | www.meettheexperts.de<http://www.meettheexperts.de> | www.more4fi.de<http://www.more4fi.de> Sitz der Gesellschaft: Düsseldorf | HRB 63043 Vorstand: Klaus Jäger (Vorsitzender) | Mirko Novakovic . Rainer Vehns Aufsichtsrat: Patric Fedlmeier (Vorsitzender) . Bernd Klinkmann . Jürgen Schütz Diese E-Mail einschließlich evtl. beigefügter Dateien enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und löschen Sie diese E-Mail und evtl. beigefügter Dateien umgehend. Das unerlaubte Kopieren, Nutzen oder Öffnen evtl. beigefügter Dateien sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.
