1. 3
  1.  

  2. 1

    Have you ever sat down to test your code and realized it’s going to be an utter pain? It may be too difficult, boring, or repetitive, it may just be too confusing… whatever the problem is you just can’t get yourself motivated to write those tests. What should you do? The easy answer: stop procrastinating and just follow the rules.

    The article fails to mention rule #1: Do not write untestable code.

    If you find that writing the tests for your code is going too be difficult, repetitive, or confusing, then you have failed in your design by not meeting the requirement of basic testability. What you should be doing is refactoring that code with an eye toward being easily verifiable- not wasting time struggling with testing the untestable.

    Next time, think about how you’ll make the code you are about to write easy to test, and don’t write code that you aren’t willing and able to test yourself.