SlideShare a Scribd company logo
BDD approaches for
 web development
   Thomas Lundström, Softhouse

        Agile testing days
         Oct 13, 2009
Agenda

• What is BDD?
• BDD for web
  applications
• BDD + Traditional
  QA?

                      http://www.flickr.com/photos/puntodevista/84796578/
BDD


• What is BDD?
* 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/
* 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/
* Focus on vocabulary
                                                   - user stories



            BDD
                                                   - acceptance criteria

                                                  Ubiquitous language!




           Vocabulary

http://www.flickr.com/photos/altemark/337248947/
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/
Why?




              BDD
                                                  * Programmer-driven
                                                  * Non-user jargon




            No silver bullet

http://www.flickr.com/photos/williamhook/1506578592/
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/
User stories


As a <role>
I want to <perform something>
So that <benefit>
User stories - example
                                      Context: A guestbook




As a public user
I want to be able to view messages
So that I can see what my friends think
Acceptance criteria          Acceptance criteria
                              defines if the soft ware
                              is done

                              One story - Many
                              acceptance criteria




Given <pre-requisite state>
When <action>
Then <outcome>
Acc. criteria - example                     This is only 2 of the
                                            possible acceptance
                                            criteria for the story




Given that there are 3 messages in the guestbook
When I view the home page
Then I should see 3 messages

Given that there are 3 messages in the guestbook
When I view the home page
Then I should see 3 messages
(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?
Tools                            Ruby: Cucumber, RSpec

                                     Java: JBehave

                                     .NET: NBehave




@deurell, http://twitpic.com/iqp9c
Focus on process - not tech!




              Tools


                 Process




http://www.flickr.com/photos/nostri-imago/3137422976/
Tool architecture

      Language

      Runner

     Glue layer

        SUT
Tool architecture

      Language

       Runner

     Web-runner

       HTML
BDD + Web apps                                         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/
Cucumber + webrat

        Gherkin

       Cucumber

    Cucumber+Webrat


         HTML
Demo
• Domain: Comment functionality (guest
  book)
 • Adding
 • Viewing
 • (In the future, it’s possible to add
    moderation, tagging etc)
Current functionality
                     Demo: current
                     functionality




• Viewing comments
New iteration             Demo: add comments

                                 * new feature
                                 * new steps
                                 * implement steps
                                 * implement web app




• New feature: adding comments
New iteration


• New feature: paging
New iteration


• New feature: deleting comments
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
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)
Test automation -
imperative/declarative




 http://www.benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories/
Test automation -
imperative/declarative


BREAK

 http://www.benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories/
Test in a BDD process
                                     We use testers to
                                     transform high-level
                                     stories to “do this, do
                                     that” specs. It’s their
                                     speciality to find these
                                     thngs!




• “Quality is not enforced by checking
  afterwards, but designed into the
  product” (my interpretation)
  - James Bach, at a discussion during Øredev
  2008
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
Thanks!

• Thomas Lundström, Softhouse
• thomas.lundstrom@softhouse.se
• Twitter: @thomaslundstrom
• http://blog.thomaslundstrom.com

More Related Content

PDF
Bdd for Web Applications at TelecomCity DevCon 2010
PDF
Simple design
PDF
Webapp acceptance testing a case study
PDF
Refactoring AOMs For AgilePT2010
PDF
David Nuescheler: Igniting CQ 5.3: What's New and Roadmap
PDF
Ruby for C#-ers (ScanDevConf 2010)
PDF
Agile DSL Development in Ruby
PDF
Railsify your web development
Bdd for Web Applications at TelecomCity DevCon 2010
Simple design
Webapp acceptance testing a case study
Refactoring AOMs For AgilePT2010
David Nuescheler: Igniting CQ 5.3: What's New and Roadmap
Ruby for C#-ers (ScanDevConf 2010)
Agile DSL Development in Ruby
Railsify your web development

Viewers also liked (9)

KEY
Dsl
PDF
The Hitchhiker’s Guide To Dsl
PPTX
Approaches to Kanban using Team Foundation Server - Dec 20
PPTX
Using Lean and Kanban to Revolutionize Your Organization
PPTX
Lean, Kanban, and TFS
PPTX
Taller capacitación en tic 1era parte
PPT
отчёт о предметной неделе по истории и обществознанию
PPTX
Continuous Delivery with VS2015 and TFS2015
PPTX
Getting Started With the TFS Object Model
Dsl
The Hitchhiker’s Guide To Dsl
Approaches to Kanban using Team Foundation Server - Dec 20
Using Lean and Kanban to Revolutionize Your Organization
Lean, Kanban, and TFS
Taller capacitación en tic 1era parte
отчёт о предметной неделе по истории и обществознанию
Continuous Delivery with VS2015 and TFS2015
Getting Started With the TFS Object Model
Ad

Similar to BDD approaches for web development at Agile Testing Days 2009 (20)

PDF
Bdd For Web Applications from Scandinavian Developer Conference 2010
PDF
The LAZY Developer's Guide to BDD (with Cucumber)
PDF
ATDD for Web Apps
PDF
Atdd for web apps
PDF
NDC 2011 - SpecFlow: Pragmatic BDD for .NET
PDF
NDC 2011 - Building .NET Applications with BDD
PPTX
BDD presentation
PDF
Behavior Driven Development - WPC 2011
PDF
Behavior Driven Development
PPTX
Testing Sap: Modern Methodology
PDF
Drupal Estimation Techniques by Project Managers
PPTX
Agile software requirements management with Impact Mapping and BDD
PDF
Agile comparison with requriement approaches
PPTX
Behaviour Driven Development
PPTX
Requirements gathering for developers
PDF
Effective entrepreneurship for developers
PDF
Agile Days Twin Cities 2011
KEY
Introduction to atdd
PDF
Engineering Software and Software Lifecycle
PDF
Acceptance Testing of Web UI
Bdd For Web Applications from Scandinavian Developer Conference 2010
The LAZY Developer's Guide to BDD (with Cucumber)
ATDD for Web Apps
Atdd for web apps
NDC 2011 - SpecFlow: Pragmatic BDD for .NET
NDC 2011 - Building .NET Applications with BDD
BDD presentation
Behavior Driven Development - WPC 2011
Behavior Driven Development
Testing Sap: Modern Methodology
Drupal Estimation Techniques by Project Managers
Agile software requirements management with Impact Mapping and BDD
Agile comparison with requriement approaches
Behaviour Driven Development
Requirements gathering for developers
Effective entrepreneurship for developers
Agile Days Twin Cities 2011
Introduction to atdd
Engineering Software and Software Lifecycle
Acceptance Testing of Web UI
Ad

Recently uploaded (20)

PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Big Data Technologies - Introduction.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPT
Teaching material agriculture food technology
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
A Presentation on Artificial Intelligence
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Machine learning based COVID-19 study performance prediction
Programs and apps: productivity, graphics, security and other tools
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Digital-Transformation-Roadmap-for-Companies.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
A comparative analysis of optical character recognition models for extracting...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Spectroscopy.pptx food analysis technology
Network Security Unit 5.pdf for BCA BBA.
Diabetes mellitus diagnosis method based random forest with bat algorithm
Big Data Technologies - Introduction.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Teaching material agriculture food technology
Unlocking AI with Model Context Protocol (MCP)
A Presentation on Artificial Intelligence
“AI and Expert System Decision Support & Business Intelligence Systems”
NewMind AI Weekly Chronicles - August'25-Week II
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Machine learning based COVID-19 study performance prediction

BDD approaches for web development at Agile Testing Days 2009

  • 1. BDD approaches for web development Thomas Lundström, Softhouse Agile testing days Oct 13, 2009
  • 2. Agenda • What is BDD? • BDD for web applications • BDD + Traditional QA? http://www.flickr.com/photos/puntodevista/84796578/
  • 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. * Focus on vocabulary - user stories BDD - acceptance criteria Ubiquitous language! Vocabulary http://www.flickr.com/photos/altemark/337248947/
  • 7. 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/
  • 8. Why? BDD * Programmer-driven * Non-user jargon No silver bullet http://www.flickr.com/photos/williamhook/1506578592/
  • 9. 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/
  • 10. User stories As a <role> I want to <perform something> So that <benefit>
  • 11. User stories - example Context: A guestbook As a public user I want to be able to view messages So that I can see what my friends think
  • 12. Acceptance criteria Acceptance criteria defines if the soft ware is done One story - Many acceptance criteria Given <pre-requisite state> When <action> Then <outcome>
  • 13. Acc. criteria - example This is only 2 of the possible acceptance criteria for the story Given that there are 3 messages in the guestbook When I view the home page Then I should see 3 messages Given that there are 3 messages in the guestbook When I view the home page Then I should see 3 messages
  • 14. (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?
  • 15. Tools Ruby: Cucumber, RSpec Java: JBehave .NET: NBehave @deurell, http://twitpic.com/iqp9c
  • 16. Focus on process - not tech! Tools Process http://www.flickr.com/photos/nostri-imago/3137422976/
  • 17. Tool architecture Language Runner Glue layer SUT
  • 18. Tool architecture Language Runner Web-runner HTML
  • 19. BDD + Web apps 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/
  • 20. Cucumber + webrat Gherkin Cucumber Cucumber+Webrat HTML
  • 21. Demo • Domain: Comment functionality (guest book) • Adding • Viewing • (In the future, it’s possible to add moderation, tagging etc)
  • 22. Current functionality Demo: current functionality • Viewing comments
  • 23. New iteration Demo: add comments * new feature * new steps * implement steps * implement web app • New feature: adding comments
  • 24. New iteration • New feature: paging
  • 25. New iteration • New feature: deleting comments
  • 26. 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
  • 27. 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)
  • 28. Test automation - imperative/declarative http://www.benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories/
  • 29. Test automation - imperative/declarative BREAK http://www.benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories/
  • 30. Test in a BDD process We use testers to transform high-level stories to “do this, do that” specs. It’s their speciality to find these thngs! • “Quality is not enforced by checking afterwards, but designed into the product” (my interpretation) - James Bach, at a discussion during Øredev 2008
  • 31. 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
  • 32. Thanks! • Thomas Lundström, Softhouse • [email protected] • Twitter: @thomaslundstrom • http://blog.thomaslundstrom.com