We also have several scenarios where the input for the scenarios are determined at runtime.
I think Paul offered a good solution, create a variable in the pageObject and set it (by the When step) then you can get it (on the Then step) for verification (I think we'll give this approach a chance) Another solution is to have a static map where you set it and then retrieve it when needed. This is what we have implemented and it works for us. Thanks, Enrique From: Hans Schwäbli [mailto:bugs.need.love....@gmail.com] Sent: Thursday, October 31, 2013 8:24 AM To: user@jbehave.codehaus.org Subject: Re: [jbehave-user] Support for dynamic variables? I see. So there is no use looking for a existing JBehave feature for this. I meant dynamic variables which are set and used at runtime. There are cases where one has to automate tests on non-deterministic test data (I mean the data of the application under test). A "life cycle" of these variables might be an issue in future. Currently I cannot tell you a real world use case for it. But I think there might be the need to configure the scope of such dynamic variables to be existing per stories, per story or per scenario. This would require a close integration into JBehave execution procedure. The easiest could be to store the variables for the whole execution and to clear them if needed in steps annotated with @BeforeStory for instance. I have to think a bit on how I could solve this in a suitable and good way. 2013/10/31 Mauro Talevi <mauro.tal...@aquilonia.org<mailto:mauro.tal...@aquilonia.org>> Typically you would define an API to access these variables. This is something that you cannot really generalise. If on the other hand you know these variable at execution time, you could pass them as system properties in the jbehave maven goal or ant task. On 31 Oct 2013, at 11:12, Hans Schwäbli <bugs.need.love....@gmail.com<mailto:bugs.need.love....@gmail.com>> wrote: > For some stories and scenarios I need dynamic variables which are determined > at runtime. > > Example: I want to store the balance of an account, do some transactions and > then expect that the balance is increased by 1000 for instance. If your test > data are not deterministic you need such approaches. > > Is there a JBehave feature for this, storing such dynamic variables at > runtime and accessing them at runtime across scenarios and stories? > > Or do I have to implement that myself in my steps? --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email