Attached is my first attempt at using a "BDD framework" instead of just using naming conventions. It was with StoryQ, but I don't know that there would be a huge difference with NBehave or MSpec. Syntax from what I can tell.
I have my language with the customer down. Seriously. The language translated into this model, however? umm....
And I really felt like I was forcing the heck out of this to make the narrative work. The framework guided me in places I would not have gone without it, and I don't think the places were all that great to visit.
For example, the framework apparently wants me to use multiple scenarios in a single [Test], which means basically I am sharing context. That just simply isn't going to work. So I jumped through some hoops to force it.
I must be missing something here, guys. Is there a fundamental way to organize these tests I am doing incorrectly? Inheritance of context doesn't feel right, either.
I ended up with 3 tests for the same story that produced the following sentences that I would never say aloud:
Story: cancel adding of a new recipe
As a person entering a new recipe
I want to to cancel the entry before I am done
So that I can change my mind about entering the recipe
Scenario 1: User confirms cancellation
Given The user is entering a recipe Passed
And The user wants to cancel Passed
When The user cancels the entry Passed
Then The view closes Passed
Story: cancel adding of a new recipe
As a person entering a new recipe
I want to to cancel the entry before I am done
So that I can change my mind about entering the recipe
Scenario 1: User denies cancellation
Given The user is entering a recipe Passed
And There is data in the entry form Passed
And The user doesnt really want to cancel Passed
When The user cancels the entry Passed
Then The user is still editing the same data Passed
And The recipe is not saved Passed
Story: cancel adding of a new recipe
As a person entering a new recipe
I want to to cancel the entry before I am done
So that I can change my mind about entering the recipe
Scenario 1: User is prompted to confirm cancellation
Given The user is entering a recipe Passed
When The user cancels the entry Passed
Then The user is presented with a confirmation Passed
And The recipe is not saved Passed
David Starr
elegantcode.com |
pluralsight.com