Slide 1

Slide 1 text

BDD & LIVING DOCS Andy Craze @accraze

Slide 2

Slide 2 text

Overview ● BDD ● Living Docs ● Combination ● Example ● Questions?

Slide 3

Slide 3 text

BDD Buzzword Driven Development? Behavior Driven Development

Slide 4

Slide 4 text

Similar to TDD Test Driven Development But focused on cross-functional teams

Slide 5

Slide 5 text

Behavior Driven Development Business Goal Features Examples Executable Specifications Application Code Automated Acceptance Criteria ● Tests ● High level Documentation ● Low-Level Documentation

Slide 6

Slide 6 text

Living Documentation ● Code is single source of truth ○ Extract the information you need. ● Dynamically create self-documenting applications ○ Generate static living docs site on each new build ● Avoid documentation antipatterns: ○ Redundant information ○ Confusing brain dumps ○ Misunderstood context

Slide 7

Slide 7 text

What should be documented? ● Will it be of interest for a long period of time? ● Will it be of interest to a large number of people? ● Will it be considered critical or valuable?

Slide 8

Slide 8 text

Automated Docs Combo Business Goal Features Examples Executable Specifications Application Code BDD + Living Docs ● Up-to-date info ● See feature progress ● Low-Level Documentation ● Integration Testing Progress Reporting Living Docs Technical Docs Validation

Slide 9

Slide 9 text

Automated Docs Combo ● Platform agnostic ● Test Runner / Framework ○ Example: Python - Behave ● ‘Reporter’ to display results ○ HTML, XML, Markdown, JSON, reStructuredText

Slide 10

Slide 10 text

Example Walkthrough ● Feature: Logging In ● Scenarios: User Logs in, Login Fail ● Automated Steps: Entering Credentials, Find Auth message ● Run Tests ● Create living docs

Slide 11

Slide 11 text

Writing a Feature file Feature: Logging In As a user I would like to login to the site So I can see my information WHO WHAT WHY

Slide 12

Slide 12 text

Describe a scenario Scenario: User logs in Given I visit the site anonymously When I log in as a registered-user Then I should see the message “Welcome back!”

Slide 13

Slide 13 text

Describe another scenario Scenario: Login Fail Given I visit the site anonymously When I log in as an unregistered-user Then I should see the message “Please sign up”.

Slide 14

Slide 14 text

Describe syntax Scenario: Given … setup When … action Then … result

Slide 15

Slide 15 text

Describe syntax Scenario: Given ... When I enter my email address And I enter my password And I click the “Login” button

Slide 16

Slide 16 text

Executable Specification ● Show your app’s expected behavior ● Automate using Selenium Webdriver ● Steps to define: ○ User visits the site anonymously ○ User logs in as "" ○ I should see the message

Slide 17

Slide 17 text

Run Executable Specifications Fail First

Slide 18

Slide 18 text

Develop a Login Form

Slide 19

Slide 19 text

Key Benefits ● Increased communication & efficiency ○ Great for cross functional teams ● Collaboration & iterative development. ○ How well does your team work together? ● High-level Docs, Low-Level Docs and Tests

Slide 20

Slide 20 text

Questions? accraze@gmail.com @accraze Blog: accraze.info