DevilKing's blog

冷灯看剑,剑上几分功名?炉香无需计苍生,纵一穿烟逝,万丈云埋,孤阳还照古陵

0%

TDD change my life

原文链接

Bugs still happen, of course, but the release of show-stopping bugs to production has dropped to near zero, even though the rate of software change and upgrade maintenance burden has increased exponentially since then.

确保主流程?

  1. Before you write implementation code, write some code that proves that the implementation works or fails. Watch the test fail before moving to the next step (this is how we know that a passing test is not a false positive — how we test our tests).
  2. Write the implementation code and watch the test pass.
  3. Refactor if needed. You should feel confident refactoring your code now that you have a test to tell you if you’ve broken something.

Murphy’s Law of Debugging:
The thing you believe so deeply can’t possibly be wrong so you never bother testing it is definitely where you’ll find the bug after you
pound your head on your desk and change it only because you’ve tried everything else you can possibly think of.