TDD. When you can move on?

后端 未结 13 1900
南旧
南旧 2021-01-11 10:36

When doing TDD, how to tell \"that\'s enough tests for this class / feature\"?

I.e. when could you tell that you completed testing all edge cases?

13条回答
  •  情歌与酒
    2021-01-11 11:17

    that common sense, there no perfect answer. TDD goal is to remove fear, if you feel confident you tested it well enough go on...

    Just don't forget that if you find a bug later on, write a test first to reproduce the bug, then correct it, so you will prevent future change to break it again!

    Some people complain when they don't have X percent of coverage.... some test are useless, and 100% coverage does not mean you test everything that can make your code break, only the fact it wont break for the way you used it!

提交回复
热议问题