Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Behavior Driven Development 101

Behavior Driven Development 101

Einführung in den methodischen Ansatz von Behavior Driven Development. Code-Beispiele von SpecFlow: https://github.com/SpecFlowOSS/SpecFlow-Examples

Steve Korzinetzki

August 10, 2022
Tweet

More Decks by Steve Korzinetzki

Other Decks in Technology

Transcript

  1. Behavior Driven Development 101 Steve Korzinetzki, August 2022

  2. Über mich Steve Korzinetzki Organisationsmitglied der Softwerkskammer Köln Suite Delivery

    Consultant @ empower GmbH Twitter: @skorzinetzki XING: Steve Korzinetzki E-Mail: steve.korzinetzki@gmail.com
  3. „Bridging the communication gap.“ Gojko Adzic

  4. „BDD practitioners explore, discover, define, then drive out the desired

    behaviour of software using conversation, concrete examples, and automated tests.“ From Cucumber for Java Book by Seb Rose, Matt Wynne and Aslak Hellesøy
  5. „BDD practitioners explore, discover, define, then drive out the desired

    behaviour of software using conversation, concrete examples, and automated tests.“ From Cucumber for Java Book by Seb Rose, Matt Wynne and Aslak Hellesøy 1. Discovery
  6. „BDD practitioners explore, discover, define, then drive out the desired

    behaviour of software using conversation, concrete examples, and automated tests.“ From Cucumber for Java Book by Seb Rose, Matt Wynne and Aslak Hellesøy 1. Discovery 2. Formulation
  7. „BDD practitioners explore, discover, define, then drive out the desired

    behaviour of software using conversation, concrete examples, and automated tests.“ From Cucumber for Java Book by Seb Rose, Matt Wynne and Aslak Hellesøy 1. Discovery 2. Formulation 3. Automation
  8. Die drei Phasen von BDD See https://cucumber.io/docs/bdd/ Discovery: What it

    could do Formulation: What it should do Automation: What it actually does
  9. Discovery

  10. Example Mapping Story Mapping Impact Mapping Die Reise agiler Anforderungen

    Goals Impacts Deliverables User Activities Epics User Stories Acceptance Criteria Examples Code Warum? Outcomes Wie? Spezifikation früher später 󰢧 User Stories: Erinnerung daran, eine Konversation zu haben
  11. Vom Product Backlog zum Sprint Backlog

  12. Vom Product Backlog zum Sprint Backlog Example Mapping Example Mapping

  13. Regeln und Beispiele Regeln Beispiele Tests Beispiele illustrieren Regeln (Anforderungen,

    Akzeptanzkriterien) (Szenarien) Beispiele steuern Tests Tests verifizieren Regeln
  14. Example Mapping in a Nutshell From https://cucumber.io/blog/bdd/example-mapping-introduction/

  15. Example Mapping in a Nutshell From https://cucumber.io/blog/bdd/example-mapping-introduction/ 3 Amigos (biz,

    dev, qa) keine Gherkin- Syntax nur WAS, nicht WIE Thumb Voting Beispiele nicht immer erforderlich 25 Minuten rot überwiegt -> DoR nicht erfüllt viel blau -> Story splitten
  16. Ein Beispiel

  17. Formulation

  18. Gherkin Syntax 🥒

  19. Gherkin Syntax Feature einleitender Prosatext zur Beschreibung der Funktionalität. Background

    ermöglicht das Aufsetzen eines Ausgangszustands für mehrere Scenarios. Scenario beschreibt einen konkreten Testfall (in Prosatext). Scenario Outlines beschreibt ein Scenario, das mit unterschiedlichen Examples ausgeführt wird. Given erzeugt einen Ausgangszustand, die Grundannahme (Arrange). When ist die konkrete Stimulierung des Systems under Test (Act). Then verifiziert das Ergebnis aus der When Stimulierung (Assert). Examples beschreibt die Test Cases für ein Scenario Outline.
  20. Ein Beispiel in Gherkin Syntax Feature: pizza-change-delivery-address As a customer

    I want to change the delivery address after ordering a pizza when not picked up yet so I can recover from delivering to the wrong address Scenario: Pizza waiting for pickup, changing delivery address should be accepted Given "Peter" orders some pizza to "home" address And the pizza is waiting for pickup When the customer wants to change the delivery address to "work" Then the system should accept the change Scenario: Pizza already picked up, changing delivery address should be denied Given "Tim" orders some pizza to "home" address And the pizza is picked up by the driver When the customer wants to change the delivery address to "work" Then the system should deny the change with message "Already picked up"
  21. Automation

  22. BDD Cycle

  23. Test Driven Development Cycle From Growing Object-Oriented Software by Nat

    Pryce and Steve Freeman
  24. Behavior Driven Development Cycle (bzw. ATDD) From Growing Object-Oriented Software

    by Nat Pryce and Steve Freeman
  25. Test Automation Pyramid

  26. Test Automation Pyramid

  27. Test Automation Pyramid aka Testing Iceberg Business betroffen / BDD

    technisch / TDD Wer hat Interesse daran, Spezifikation zu lesen?
  28. Hexagonal Architecture

  29. „Allow an application to equally be driven by users, programs,

    automated test or batch scripts, and to be developed and tested in isolation from its eventual run-time devices and databases.“ Alistair Cockburn
  30. Hexagonal Architecture

  31. Hexagonal Architecture

  32. BDD-Automation-Tools: Cucumber (Java), SpecFlow (.NET), …

  33. Automation Code Examples

  34. Specflow Reporting Bookshop Example

  35. Cukedoktor Reporting Example

  36. Empfehlungen, Vertiefungen

  37. Empfehlungen, Vertiefungen Softwerkskammer Köln 12.09.22: Revisionssicher Testen mit Cucumber &

    Testcontainers Devcouch Podcast: Episode Faszination Speckstein. Specflow muss versteckt sein. (09.02.2020) BDD Books: Discovery, Formulation, Automation https://bddbooks.com/ Cucumber: BDD Automatisierung https://cucumber.io/ Cukedoktor: Tool für Reporting von Cucumber Tests https://github.com/rmpestano/cukedoctor
  38. Vielen Dank! Zeit für etwas Q&A 😉