Presentation about using BDD for web applications from Scandinavian Developer Conference, March 17 in Gothenburg, Sweden.
The presentation is designed to work with demonstrations, where I show how Cucumber is used to specify a Java Wicket web app.
4. * “BDD aims to bridge the gap bet ween
the differing views of computer
BDD
systems held by Business users and
Technologists. It is deeply rooted in the
success of TDD and is influenced by
ideas like Domain Driven Design. Its
focus is on minimizing the hurdles
bet ween specification, design,
implementation and confirmation of
the behaviour of a system.”
Stakeholders
http://www.flickr.com/photos/zunami/3709268689/
5. * Golden triangle bet ween analyst’s
requirements, acceptance tests from
BDD
the test department and the “Done”
criteria for a feature used by the
developers
* Team effort
- Analyst
- Tester
Reqs
- Developer/Architect
Test Done
http://www.flickr.com/photos/qthomasbower/3426242870/
6. User stories
BDD builds upon the conversation
taking place in user stories and
acceptance criteria.
As a <role>
I want to <perform something>
So that <benefit>
7. Acceptance criteria Acceptance criteria
defines if the soft ware
is done
One story - Many
acceptance criteria
Given <pre-requisite state>
When <action>
Then <outcome>
8. User stories - example
Context: comments for
e.g. articles on a news
site
As a public user
I want to be able to view messages
So that I can see what my friends think
9. Acc. criteria - example one story - many
acceptance criteria
This is only 2 of the
possible acceptance
criteria for the story
Given that there are 3 messages in the comment page
When I view the comment page
Then I should see 3 messages
Given that the comment page is empty
When I view the comment page
Then I should see 0 messages
10. (If we work with iterations)
BDD
Before we do something, we need to agree
upon what we should deliver = before
stories are pulled into the iteration, we
define the acceptance criteria for the
story
Based on the acceptance criteria and our
estimations, we include X number of
stories to deliver in the iteration
Important: we can’t commit to deliver
something unless we know what to deliver
= be thorough in splitting a story in
acceptance criteria
How to use BDD in
an iteration?
11. * Focus on vocabulary
- user stories
BDD
- acceptance criteria
Ubiquitous language!
Vocabulary
http://www.flickr.com/photos/altemark/337248947/
12. BDD
* Outside-in
- onion
- use the words of the user, not the
programmer
* Connection DDD - BDD: use ubiquitous
language when specifying the user
words
* Unit-level tests are still needed
Outside-in
http://www.flickr.com/photos/redcherryhill/389325062/
13. This is a tool in your toolbox. Use as
needed.
BDD
No silver bullet
http://www.flickr.com/photos/williamhook/1506578592/
14. This is what I find the most interesting
with the whole discussion about BDD.
Why BDD? - executable specifications
- focus on requirements
- everything builds upon user stories/
acceptance criteria
http://www.flickr.com/photos/22280677@N07/3342653727/
19. BDD + Web apps Perfect marriage!
All web apps use the same
tech to communicate
HTML (+ javascript) is the
lingua franca for web
development
http://www.flickr.com/photos/rubyran2626/296913361/
25. How to include this into
CI environment
the regular CI env?
Depends on what you
run
Here: easy with maven2
In .NET land, e.g. msbuild
or Ant/Java, let the
build script launching
the acceptance criteria
run
Results from the acc
criteria run should be
output to html so that
we know how far we’ve
gotten
• Run acceptance criteria in the build
26. Test automation
Is there a difference bet ween BDD and the test
automation we’ve previously used?
- It depends on how the test automation was done
- with BDD, we’ve got test automation aligned with
(that are) the requirements!
Earlier: test automation prone to breakage.
Why?
- dev changes stuff (button names etc) that test
automation uses (fixed by running everything in
the build; everyone is in charge of the build, instead
of only the test dept)
• BDD vs. Test automation? - Requirements churn (we can’t guard from that)
- Unstable tools (no guard here either)
29. Test in a BDD process We use testers to transform
high-level stories to “do this,
do that” specs, which
preferably are automated.
It’s their speciality to find
these thngs!
• “You can not inspect quality into the
product; it’s already there”
- W. Edwards Deming
30. Test in a BDD process
Testers can go from performing
manual script labour to do more
useful stuff
- exploratory testing
- helping devs & analysts analyse the
problem
- Performance testing
The competence of the testers i.e.
translation of abstract Reqs ->
hands-on runnables is used when
defining acceptance criteria
http://en.wikipedia.org/wiki/File:Systems_Engineering_Process_II.gif