How are Mocks meant to be used?

前端 未结 9 1614
陌清茗
陌清茗 2020-12-13 14:45

When I originally was introduced to Mocks I felt the primary purpose was to mock up objects that come from external sources of data. This way I did not have to maintain an

9条回答
  •  感情败类
    2020-12-13 14:59

    As someone said before, if you mock everything to isolate more granular than the class you are testing, you give up enforcing cohesion in you code that is under test.

    Keep in mind that mocking has a fundamental advantage, behavior verification. This is something that stubs don't provide and is the other reason that makes the test more brittle (but can improve code coverage).

提交回复
热议问题