Hi Arpit, I too agree with Brian's suggestions. In addition you may want to also consider the ability to use parametrised scenarios and given stories.
http://jbehave.org/reference/stable/parametrised-scenarios.html http://jbehave.org/reference/stable/given-stories.html Cheers On 18/03/2011 11:54, Brian Repko wrote: > > Arpit, > > Thanks for the question and the example - that helps explain it alot! > > The first point is that the verification of the object with ID > "testFoo1" sounds like another Then clause on the first scenario - in > which case you would keep the object around in a step as an instance > variable perhaps. > > The other way to do this is to move the creation of the object into a > Given Story or perhaps the second story can use the first as a given. > > If none of those work, then you will need to create some object that > holds the "memory model" (much like the memory model for web apps is > application / session / conversation / request). The first story can > create an ID in that model somewhere and then the second story can get > that value. Not very clean but not unheard of. > > Hope that helps... > Brian > > ----- Original message ----- > From: "Arpit Sakhi" <[email protected]> > To: "[email protected]" <[email protected]> > Date: Fri, 18 Mar 2011 15:29:16 +0530 > Subject: [jbehave-user] passing parameters from one story to another > > > Would it be possible to pass parameters in between the stories. Let me > elaborate my query with example. > > > > Suppose I have a story test1. I have written few steps in it and last > step creates an object in my application with ID as “testFoo1”, Id > will be generated dynamically by story1 steps. > > Now I want story 2 (lets say test2) to verify the object created with > ID as “testFoo1” (Generated in first story). Since the story 1 > creating the id dynamically I can not define that in story2 > beforehand. Is there any way to get that object id in story 2 for > verification? > > > > Any suggestion would be of great help. > > > > Thanks in Advance > > Arpit > > DISCLAIMER ========== This e-mail may contain privileged and > confidential information which is the property of Persistent Systems > Ltd. It is intended only for the use of the individual or entity to > which it is addressed. If you are not the intended recipient, you are > not authorized to read, retain, copy, print, distribute or use this > message. If you have received this communication in error, please > notify the sender and delete all copies of this message. Persistent > Systems Ltd. does not accept any liability for virus infected mails. > > --- > Brian Repko > LearnThinkCode, Inc. <http://www.learnthinkcode.com> > email: [email protected] > <mailto:[email protected]> > phone: +1 612 229 6779
