Skip to content

Instantly share code, notes, and snippets.

@mikaelvesavuori
Created July 23, 2023 08:26
Show Gist options
  • Save mikaelvesavuori/47585ee71a4e6adf77f9597098a278ff to your computer and use it in GitHub Desktop.
Save mikaelvesavuori/47585ee71a4e6adf77f9597098a278ff to your computer and use it in GitHub Desktop.
Book notes - "Test-Driven Development by Example" (Kent Beck)

Book notes - "Test-Driven Development by Example" (Kent Beck)

Red/green/refactor:

  • Red: Write a test that does not work, maybe does not even compile
  • Green: Make the test work quickly, be OK with any "sins" this might entail
  • Refactor: Eliminate duplication and "sins"

Social effects of writing tests:

  • Low defect density means QA can be proactive not reactive
  • Reduced number of nasty surprises means project managers can actually involve real customers
  • Clarified technical conversations means teams can work on a minute-by-minute basis rather than daily/weekly
  • Having shippable software everyday leads to new business relationships with customers

"Regression tests are tests that, with perfect foreknowledge, you would have written when coding originally. Every time you have to write a regression test, think about how you would have known to write the test in the first place." (page 138)

What don't you have to test? Phlip: "Write tests until fear is transformed into boredom." (page 194)

Write tests for:

  • Conditionals
  • Loops
  • Operations
  • Polymorphism

"But only those that you write. Unless you have reason to distrust it, don't test code from others."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment