Exactly what is integration testing - compared with unit

前端 未结 5 1934
广开言路
广开言路 2021-02-01 14:18

I am starting to use unit testing in my projects, and am writing tests that are testing at the method/function level.

I understand this and it makes sense.

But,

5条回答
  •  有刺的猬
    2021-02-01 15:00

    Here are a couple of constraints that a good unit test satisfies. Meeting these constraints also required good testable code.

    1. No I/O - disk or network
    2. Only one assertion (if multiple, they should be minor variations of each other)
    3. Does not exercise (cover) much more production code than what it asserts

    These constraints usually don't apply to integration tests.

提交回复
热议问题