Hi Rickard,

Rickard Öberg wrote:
Hey,

I'm in the process of starting a new project for doing GTD on both individual and organizational levels, and was shopping around for test frameworks. Knowing Dan I looked into JBehave, and found it to be absolutely wonderful! I integrated it with Qi4j(.org), which is the app framework we are using, in about an hour, and now feel reasonably comfortable with the process. The integration includes automatically adding the Steps to the UI layer of the app to be tested, so that it can use dependency injection to access the UI and Application layers to perform the actual testing. This is mostly for functional testing rather than unit testing, I should say.

Absolutely, functional, acceptance and regression testing is the primary scope of BDD.

Pretty neat! The key trick is as I said that this code automatically gets registered in the UI layer of the application, so when it is run it will see everything that the UI would see normally.

What I am wondering about now is how to build up a scenario state that is fairly complex in order to test scenarios that require a lot things to have happened. The above does the login. But then I need another for accessing the inbox and creating a task. Then another for marking that task with tags, and yet another for adding attachments to it. All of these scenarios require more and more "Givens", I guess, and the question is how you build up such a complex state? Any advice?

You can easily assign member variables to the Steps class to keep the state between steps. JBehave will simply run them in the order in which you've specified in the scenario. E.g.

Given a user with login Rickard
And a inbox
When the user logs in
Then the inbox is accessed

The first and second steps would create user and inbox object references (be they strings or other bespoke objects) and have them available as member variables for the other steps.

Hope that's clear, or I can provide a more detailed example in our examples codebase.

Cheers


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

   http://xircles.codehaus.org/manage_email


Reply via email to