Skip to content

Testing Deepdive Sumup

Here my follow-/sum-up of a Testing deep dive I gave:

Motivation for writing Tests

  • To avoid manual process (Out of pure laziness)
    • Don’t repeat your manual work flow :D
    • test setup/preconditions are exactly the same
    • ideal you never have to start irb / application server to test
  • To verify the code aligns & fulfils all the assumptions
    • gain confidence
  • To indicate other what’s important
    • to secure that new code doesn’t change/break current state
    • to avoid surprises
    • give confidence
  • Documentation
    • allows other to understand you code quickly
    • good example ->
  • Avoid Bugs before they even exists ;)

Test Types

Follow the Pyramid (

  • (little) End2End (Acceptance),
    • no stubbing
    • full scenarios
  • (some) Integration
    • cover the full interface your code integrates (different call/inputs, return values, exceptions)
    • static data
    • some stubbing
  • (at lot of) Unit
    • Low level
    • stub external
    • all public method, each condition/parameter combination should be a test case
  • refactor usually break unit, but shouldn’t integration and for sure not End2End

Test Structure

  1. Setup static State (be aware of Time)
  2. Execute
  3. Assert


  • Prefer copy & past over magic/bad abstraction
  • be simple, explicit, verbose

Little Helpers

GitPrePush Hook:

  • copy this in .git/hooks of every project
  • skip with git push --no-verify

See all test statuses:

Download, create a access token here and use this url in ccmenu:<token>

Keep in mind

  • make test should always work on your local machine
  • Avoid introducing code/merging PR when dependencies build are broken
  • Make sure new code integrates nicely with dependencies/or update dependencies asap.
  • Rebase branch on current master(HEAD) before merge

Pls share your opinions/experience/ideas on how to kill all the bugs and to maintain a simple & obvious development process for everyone!