Why should I bother with unit testing if I can just use integration tests?

前端 未结 12 1388
别那么骄傲
别那么骄傲 2021-02-03 21:53

Ok, I know I am going out on a limb making a statement like that, so my question is for everyone to convince me I am wrong. Take this scenario:

I have method A, which ca

12条回答
  •  遇见更好的自我
    2021-02-03 22:08

    Unit tests aren't about debugging during initial development. They're about design, and they're about adapting to change. My unit tests almost never tell me where a bug is when I'm on my first pass through a hunk of code. My tests warn me when a bug arises six months later because somebody (possibly I myself) tweaked an object whose relationships they didn't fully understand.

    Saying unit tests are a waste of time during initial develoment is like complaining that my car gets crappy mileage on its way out of my driveway.

提交回复
热议问题