JBehave is an application that converts XP Stories into JBehave behaviours. JBehave can then regenerate the XP Stories from these Jbehave behaviours. In other words, the Jbehave code is self documenting.
Lets start with a simple example XP Story from an ATM application.
Story: Request Cash
As a bank account holder
I would like to withdraw cash from an ATM
so that I do not need to visit my branch.
Acceptance Criteria: Successfully withdraw cash
Given the account is in credit [balance = 50]
When the user requests cash [request 20]
Then reduce balance [balance = balance – 20 =30]
and dispense cash [dispense 20]
and return card.
This story consists of the name, a description, and an acceptance criteria.
JBehave will use this Story to create a class called RequestCash which contains a description and a single acceptance criteria. In addition it will create Jbehave classes. A “given” class called theAccountIsInCredit which contains the comment /* balance = 50 /, an “event” class called theUserRequestsCash with the comment / request 20 /, and three “outcome” class called reduceBalance with the comment / balance = balance – 20 =30 /, dispenseCash with comment / dispense 20 */, and returnCard.
A developer then adds code into the Jbehave classes that is used to test the behaviours of the classes or component. Jbehave runs the behaviour indicating whether the it has run successfully or not.
Posted by chrismatts at November 30, 2004 5:12 PMThat is fine, but how do you get Jbhave to parse the story text in order to generate the classes ?
Posted by: James Fisk at December 9, 2004 9:08 PM