Test to Break Principles

99a446aac48cfaf36593646d5565a830?s=47 Rob Waller
February 01, 2019

Test to Break Principles

There are two types of tests a developer can write, ‘test to work’ and ‘test to break’. Both are essential to robust development, but many developers only use the former and not the latter. This talk explains why ‘test to break’ principles are essential to ensure robust application development.

99a446aac48cfaf36593646d5565a830?s=128

Rob Waller

February 01, 2019
Tweet

Transcript

  1. 1.
  2. 7.

    W: rbrt.wllr.info | T: @RobDWaller TDD Tips Test Business Logic

    Test Private Methods Test Input / Output Test Big Methods Do Don’t
  3. 9.

    W: rbrt.wllr.info | T: @RobDWaller Example 1. Given the driver

    has a valid car key. When they insert the key into the ignition. And they turn the key. Then the car's engine starts.
  4. 10.

    W: rbrt.wllr.info | T: @RobDWaller Example 2. Given the driver

    has an invalid car key. When they insert the key into the ignition. And they turn the key. Then the car's engine will not start.
  5. 12.

    W: rbrt.wllr.info | T: @RobDWaller Example 1. Given the driver

    has a screwdriver. When they insert it into the ignition. And turn the screwdriver. Then the car's engine will not start.
  6. 13.

    W: rbrt.wllr.info | T: @RobDWaller Example 2. Given a car

    is traveling at 30 mph. When it hits a tree. Then all the seat belts tighten. And the airbags deploy.
  7. 25.

    W: rbrt.wllr.info | T: @RobDWaller Rules 1. Cars can only

    be black. 2. Cars can have two or four doors. 3. Cars must have four wheels.
  8. 28.

    W: rbrt.wllr.info | T: @RobDWaller Summary ‘Working’ software is not

    good enough. Writing good software is hard. You are ignorant. Your problems are complicated. Always write tests. Stress and break your business logic. Code will work in one way always.