How do you tell that your unit tests are correct?

后端 未结 16 1280
广开言路
广开言路 2020-12-28 16:23

I\'ve only done minor unit testing at various points in my career. Whenever I start diving into it again, it always troubles me how to prove that my tests are correct. How

16条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-28 16:51

    You can't prove tests are correct, and if you're trying to, you're Doing It Wrong.

    Unit tests are a first screen - a smoke test - like all automated testing. They are primarily there to tell you if a change you make later on breaks stuff. They are not designed to be a proof of quality, even at 100% coverage.

    The metric does make management feel better, though, and that is useful in itself sometimes!

提交回复
热议问题