Hi Russel,

Just to add some points to you see how good and flexible Jbehave is....

Instead of database, I choosed to use an EMF model (serialized as XMI and saved in GIT with code) to maintain knowledge data about my product stories, for example: UI name and fields details, entities, processes and rules data.

I've created a generic StoryKnManager class that supply all info needed to execute stories. So an instance of this class is injected (using Guice and annotations) on Jbehave steps for execution. What I need to worry is how I will share guice modules from a business perspective... so I could *mount a context module* just compounding it from other modules.

Well, this approach has some other benefits too: code generation using ATL, XPAND, Acceleo or another eclipse modeling project.

cheers

Cristiano

On 17/02/11 11:44, Russell Brown wrote:
Hi,
I'm trying to get my head around JBehave right now. I love using it and it is a 
great BDD project. My project is getting pretty big now and there are quite a 
lot of steps. We are striving for step reuse but I have some questions about 
the context and order of step execution.

If I use the example from your documents 
http://jbehave.org/reference/stable/developing-stories.html

In this case, if the

     When the stock is traded at 5.0

     @When("the stock is traded at $price")
     public void theStockIsTradedAt(double price) {
         stock.tradeAt(price);
     }

step  is used by a different story, one that didn't start with the


     Given a stock of symbol STK1 and a threshold of 10.0

      @Given("a stock of symbol $symbol and a threshold of $threshold")
     public void aStock(String symbol, double threshold) {
         stock = new Stock(symbol, threshold);
     }


Then you have an NPE? Is that right?

My question is really about how to manage state (or context) for a Step class. 
If your steps create/modify/read state from the enclosing class then they 
cannot really be mixed and matched, or can they?
Also, thread wise... I assume that you guarantee that only one thread runs the 
steps in sequence? And that only a single story is run at a time (IE the app is 
totally single threaded in its execution)?

In the case that a Given step from one class proceeds a When step from another 
class which proceeds a Then step from a third class, is there any shared memory 
that they call access (like a Story Context or something?)

In the case that Spring is used, all the steps will be singletons...with 
state...and resused steps may read stale state...so many questions.

Is there a simple, best practice style answer like "All Steps should be in the same 
class" or "Stories don't have state" or something like that?

Love JBehave but I really need  a steer on the above: State, Order, Threads

Many thanks

Russell

This e-mail and any attachments are confidential and intended solely for the 
addressee and may also be privileged or exempt from disclosure under applicable 
law. If you are not the addressee, or have received this e-mail in error, 
please notify the sender immediately, delete it from your system and do not 
copy, disclose or otherwise act upon any part of this e-mail or its attachments.

Internet communications are not guaranteed to be secure or virus-free. ioko365 
Limited does not accept responsibility for any loss arising from unauthorised 
access to, or interference with, any Internet communications by any third 
party, or from the transmission of any viruses.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

     http://xircles.codehaus.org/manage_email



Reply via email to