I write my user stories like this:
As a [role]
I want to [do something]
So that I [get some business value]
Let's look at an example (read it column by column).
| As a/an | I want to... | so that... |
| web designer | create a default layout for my site | I can decide the look and feel I want |
Now, how can I verify that my application has implemented this story? To do that you can use Stormwind Accuracy. It's an excellent tool to implement acceptance tests by BDD. And if you have any feedback about it then Bernardo Heynemann is glad to hear from you.
Ok. Let's write a test to verify that in our story we can save a template for our site.
First we setup the story
1: story = Story 2: .AsA("web designer")
3: .IWantTo("create a default layout for my site")
4: .SoThat("I can decide the look and feel I want");
1: story.WithScenario("User can save valid template")
2: .Given(I.GoTo("Create Template Page"))
3: .When(I.Fill("Template name").TextBox.With("MyTemplate"))
4: .And(I.Fill("template content").TextBox.With("MyTemplateContent"))
5: .And(I.Click("template save").Button)
6: .Then(I.WaitFor("Template saved successfully").Message);
When we then run our story (test) we will get this output
When_creating_templates.Should_save_valid_template : Passed
Story:As a web designer
I want to create a default layout for my site
so that I can decide the look and feel I want
Scenario 1: User can save valid template
Narrative:
Given That
I navigate to Create Template Page at http://localhost/admin/template/new
When
I fill the Template name with "MyTemplate"
And I fill the template content with "MyTemplateContent"
And I click the "template save" button
Then
Wait for the message Template saved successfully to appear.
Compare the output with the story definition in the beginning. Sweet!
Now I can have "automagic" acceptance tests to verify that my application works for future changes. Today and tomorrow!

1 comments:
Thanks A LOT for the kind post Martin!!!
Bernardo Heynemann
Post a Comment