Slide 1

Slide 1 text

Behavior Driven Development 101 Steve Korzinetzki, August 2022

Slide 2

Slide 2 text

Über mich Steve Korzinetzki Organisationsmitglied der Softwerkskammer Köln Suite Delivery Consultant @ empower GmbH Twitter: @skorzinetzki XING: Steve Korzinetzki E-Mail: [email protected]

Slide 3

Slide 3 text

„Bridging the communication gap.“ Gojko Adzic

Slide 4

Slide 4 text

„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

Slide 5

Slide 5 text

„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

Slide 6

Slide 6 text

„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

Slide 7

Slide 7 text

„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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

Discovery

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

Vom Product Backlog zum Sprint Backlog

Slide 12

Slide 12 text

Vom Product Backlog zum Sprint Backlog Example Mapping Example Mapping

Slide 13

Slide 13 text

Regeln und Beispiele Regeln Beispiele Tests Beispiele illustrieren Regeln (Anforderungen, Akzeptanzkriterien) (Szenarien) Beispiele steuern Tests Tests verifizieren Regeln

Slide 14

Slide 14 text

Example Mapping in a Nutshell From https://cucumber.io/blog/bdd/example-mapping-introduction/

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

Ein Beispiel

Slide 17

Slide 17 text

Formulation

Slide 18

Slide 18 text

Gherkin Syntax 🥒

Slide 19

Slide 19 text

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.

Slide 20

Slide 20 text

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"

Slide 21

Slide 21 text

Automation

Slide 22

Slide 22 text

BDD Cycle

Slide 23

Slide 23 text

Test Driven Development Cycle From Growing Object-Oriented Software by Nat Pryce and Steve Freeman

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

Test Automation Pyramid

Slide 26

Slide 26 text

Test Automation Pyramid

Slide 27

Slide 27 text

Test Automation Pyramid aka Testing Iceberg Business betroffen / BDD technisch / TDD Wer hat Interesse daran, Spezifikation zu lesen?

Slide 28

Slide 28 text

Hexagonal Architecture

Slide 29

Slide 29 text

„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

Slide 30

Slide 30 text

Hexagonal Architecture

Slide 31

Slide 31 text

Hexagonal Architecture

Slide 32

Slide 32 text

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

Slide 33

Slide 33 text

Automation Code Examples

Slide 34

Slide 34 text

Specflow Reporting Bookshop Example

Slide 35

Slide 35 text

Cukedoktor Reporting Example

Slide 36

Slide 36 text

Empfehlungen, Vertiefungen

Slide 37

Slide 37 text

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

Slide 38

Slide 38 text

Vielen Dank! Zeit für etwas Q&A 😉