SlideShare ist ein Scribd-Unternehmen logo
1 von 31
BDD approaches for
 web development
        Thomas Lundström, Softhouse

Scandinavian Developer Conference, Gothenburg
                 Mar 17, 2010
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/
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>
Acceptance criteria          Acceptance criteria
                              defines if the soft ware
                              is done

                              One story - Many
                              acceptance criteria




Given <pre-requisite state>
When <action>
Then <outcome>
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
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
(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?
* 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/
This is a tool in your toolbox. Use as
                                                  needed.



              BDD




            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/
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                                         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/
Cucumber + webrat

        Gherkin

       Cucumber

    Cucumber+Webrat


         HTML
Demo

• Domain: Comment functionality
 • 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
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, 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
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

Weitere ähnliche Inhalte

Ähnlich wie Bdd For Web Applications from Scandinavian Developer Conference 2010

Behavior Driven Development - WPC 2011
Behavior Driven Development - WPC 2011Behavior Driven Development - WPC 2011
Behavior Driven Development - WPC 2011Fabio Armani
 
German Testing Day 2015 - How behavior-driven development fuses developers an...
German Testing Day 2015 - How behavior-driven development fuses developers an...German Testing Day 2015 - How behavior-driven development fuses developers an...
German Testing Day 2015 - How behavior-driven development fuses developers an...Bastian Seehaus
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven DevelopmentAdam Englander
 
Myths and Challenges of Behaviour Driven Development
Myths and Challenges of Behaviour Driven DevelopmentMyths and Challenges of Behaviour Driven Development
Myths and Challenges of Behaviour Driven DevelopmentPankaj Nakhat
 
Approaching ATDD/BDD
Approaching ATDD/BDDApproaching ATDD/BDD
Approaching ATDD/BDDDhaval Dalal
 
BDD presentation
BDD presentationBDD presentation
BDD presentationtemebele
 
TorontoRb Intro to BDD
TorontoRb   Intro to BDDTorontoRb   Intro to BDD
TorontoRb Intro to BDDnunick
 
Acceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkAcceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkSteve Zhang
 
Test Automation Framework using Cucumber BDD overview (part 1)
Test Automation Framework using Cucumber BDD overview (part 1)Test Automation Framework using Cucumber BDD overview (part 1)
Test Automation Framework using Cucumber BDD overview (part 1)Mindfire Solutions
 
A study of the characteristics of Behaviour Driven Development
A study of the characteristics of Behaviour Driven DevelopmentA study of the characteristics of Behaviour Driven Development
A study of the characteristics of Behaviour Driven DevelopmentCarlos Solís
 
Lessons learned in rolling out BDDs in a large project
Lessons learned in rolling out BDDs in a large projectLessons learned in rolling out BDDs in a large project
Lessons learned in rolling out BDDs in a large projectCampus Interaction
 
Practiced agile developer with tdd & bdd
Practiced agile developer with tdd & bdd Practiced agile developer with tdd & bdd
Practiced agile developer with tdd & bdd Sakares Saengkaew
 
Topic tdd-and-bdd b4usolution
Topic tdd-and-bdd b4usolutionTopic tdd-and-bdd b4usolution
Topic tdd-and-bdd b4usolutionHoa Le
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by ExampleNalin Goonawardana
 
Making the Move to Behavior Driven Development
Making the Move to Behavior Driven DevelopmentMaking the Move to Behavior Driven Development
Making the Move to Behavior Driven DevelopmentQASymphony
 
Behaviour Driven Development
Behaviour Driven DevelopmentBehaviour Driven Development
Behaviour Driven DevelopmentBen Goldin
 
[DSBW Spring 2009] Unit 03: WebEng Process Models
[DSBW Spring 2009] Unit 03: WebEng Process Models[DSBW Spring 2009] Unit 03: WebEng Process Models
[DSBW Spring 2009] Unit 03: WebEng Process ModelsCarles Farré
 
Stc 2015 regional-round-ppt-bdd along with ci
Stc 2015 regional-round-ppt-bdd along with ciStc 2015 regional-round-ppt-bdd along with ci
Stc 2015 regional-round-ppt-bdd along with ciArchana Krushnan
 

Ähnlich wie Bdd For Web Applications from Scandinavian Developer Conference 2010 (20)

Behavior Driven Development - WPC 2011
Behavior Driven Development - WPC 2011Behavior Driven Development - WPC 2011
Behavior Driven Development - WPC 2011
 
German Testing Day 2015 - How behavior-driven development fuses developers an...
German Testing Day 2015 - How behavior-driven development fuses developers an...German Testing Day 2015 - How behavior-driven development fuses developers an...
German Testing Day 2015 - How behavior-driven development fuses developers an...
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven Development
 
Myths and Challenges of Behaviour Driven Development
Myths and Challenges of Behaviour Driven DevelopmentMyths and Challenges of Behaviour Driven Development
Myths and Challenges of Behaviour Driven Development
 
Approaching ATDD/BDD
Approaching ATDD/BDDApproaching ATDD/BDD
Approaching ATDD/BDD
 
BDD presentation
BDD presentationBDD presentation
BDD presentation
 
TorontoRb Intro to BDD
TorontoRb   Intro to BDDTorontoRb   Intro to BDD
TorontoRb Intro to BDD
 
Acceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkAcceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot Framework
 
Test Automation Framework using Cucumber BDD overview (part 1)
Test Automation Framework using Cucumber BDD overview (part 1)Test Automation Framework using Cucumber BDD overview (part 1)
Test Automation Framework using Cucumber BDD overview (part 1)
 
A study of the characteristics of Behaviour Driven Development
A study of the characteristics of Behaviour Driven DevelopmentA study of the characteristics of Behaviour Driven Development
A study of the characteristics of Behaviour Driven Development
 
Lessons learned in rolling out BDDs in a large project
Lessons learned in rolling out BDDs in a large projectLessons learned in rolling out BDDs in a large project
Lessons learned in rolling out BDDs in a large project
 
Practiced agile developer with tdd & bdd
Practiced agile developer with tdd & bdd Practiced agile developer with tdd & bdd
Practiced agile developer with tdd & bdd
 
Topic tdd-and-bdd b4usolution
Topic tdd-and-bdd b4usolutionTopic tdd-and-bdd b4usolution
Topic tdd-and-bdd b4usolution
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by Example
 
Making the Move to Behavior Driven Development
Making the Move to Behavior Driven DevelopmentMaking the Move to Behavior Driven Development
Making the Move to Behavior Driven Development
 
Behaviour Driven Development
Behaviour Driven DevelopmentBehaviour Driven Development
Behaviour Driven Development
 
[DSBW Spring 2009] Unit 03: WebEng Process Models
[DSBW Spring 2009] Unit 03: WebEng Process Models[DSBW Spring 2009] Unit 03: WebEng Process Models
[DSBW Spring 2009] Unit 03: WebEng Process Models
 
BDD along with Continuous Integration
BDD along with Continuous IntegrationBDD along with Continuous Integration
BDD along with Continuous Integration
 
Stc 2015 regional-round-ppt-bdd along with ci
Stc 2015 regional-round-ppt-bdd along with ciStc 2015 regional-round-ppt-bdd along with ci
Stc 2015 regional-round-ppt-bdd along with ci
 
Bdd
BddBdd
Bdd
 

Kürzlich hochgeladen

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Kürzlich hochgeladen (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

Bdd For Web Applications from Scandinavian Developer Conference 2010

  • 1. BDD approaches for web development Thomas Lundström, Softhouse Scandinavian Developer Conference, Gothenburg Mar 17, 2010
  • 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. 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/
  • 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 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/
  • 20. Cucumber + webrat Gherkin Cucumber Cucumber+Webrat HTML
  • 21. Demo • Domain: Comment functionality • 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. 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)
  • 27. Test automation - imperative/declarative http://www.benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories/
  • 28. Test automation - imperative/declarative BREAK http://www.benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories/
  • 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
  • 31. Thanks! • Thomas Lundström, Softhouse • thomas.lundstrom@softhouse.se • Twitter: @thomaslundstrom • http://blog.thomaslundstrom.com