Why are functional tests not enough? What do unit tests offer?

前端 未结 8 1131
庸人自扰
庸人自扰 2020-12-25 09:02

I just had a conversation with my lead developer who disagreed that unit tests are all that necessary or important. In his view, functional tests with a high enough code cov

8条回答
  •  失恋的感觉
    2020-12-25 09:34

    Off the top of my head

    • Unit tests are repeatable without effort. Write once, run thousands of times, no human effort required, and much faster feedback than you get from a functional test
    • Unit tests test small units, so immediately point to the correct "sector" in which the error occurs. Functional tests point out errors, but they can be caused by plenty of modules, even in co-operation.
    • I'd hardly call an interface change "an inner refactoring". Interface changes tend to break a lot of code, and (in my opinion) force a new test loop rather than none.

提交回复
热议问题