Skip to content

Files

Latest commit

b2b399b · Dec 13, 2019

History

History
84 lines (54 loc) · 1.25 KB

04-tdd.md

File metadata and controls

84 lines (54 loc) · 1.25 KB

now you know the tooling!


Let's use testing to DRIVE our development!


Recap: Traditional approach

  • Design
  • Imlementation
  • Test

Drawbacks when writing tests at end

  • low test coverage
  • late testing: rethink problem
  • knowledge of implementation: changes how tests are written
  • not automated

Test-Driven Development (TDD)

  • Design
  • Test
  • Implementation

TDD Workflow

  • Red
  • Green
  • Refactor

tdd-cycle


  • no code without test
  • untested code should not go live
  • baby steps: only write code to make test pass

green bar pattern

  • "fake it til you make it"
  • triangulation
  • obvious implementation

Advantages of TDD

  • high test coverage
  • increases modularity
  • improves maintainability
  • implicit documentation

let's code

Fizz-Buzz Kata


Schools of TDD

  • Classical
    • aka Detroit, Chicago, "inside-out", "fake it til you make it"
    • K. Beck: Test-Driven Development By Example
  • London
    • aka moquist, "outside-in"
    • Freeman & Pryce: Growing Object Oriented Software Guided by Tests
  • Munich: David Voelkl
  • Hamburg: Ralph Westpfahl