Pragmatic unit testing - summary

·

1 min read

https://www.youtube.com/watch?v=5iJWOPaNZDA

Unit tests should do two things

  • ensure you can refactor the code, and the unit test will still pass

    • So the test must be at a high enough level that it is testing the desired outcome / behaviour of the code, and not testing how the code is implemented
  • guard against regressions, aka bugs

It's often easy to do one, but it requires thought to do both