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

前端 未结 12 1351
别那么骄傲
别那么骄傲 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:18

    If A is a query that runs for 2 hours, and prepares data for B, which is another query that runs for 2 hours, why should I wait 4 hours to find a problem when I could wait 2? It's not like this is a new idea. Do you think car companies assemble the entire car before seeing if the engine works?

提交回复
热议问题