What is Mocking?

前端 未结 8 1253
遥遥无期
遥遥无期 2020-11-22 03:15

What is Mocking?                                                                                                    .

8条回答
  •  野性不改
    2020-11-22 03:56

    Mock is a method/object that simulates the behavior of a real method/object in controlled ways. Mock objects are used in unit testing.

    Often a method under a test calls other external services or methods within it. These are called dependencies. Once mocked, the dependencies behave the way we defined them.

    With the dependencies being controlled by mocks, we can easily test the behavior of the method that we coded. This is Unit testing.

    What is the purpose of mock objects?

    Mocks vs stubs

    Unit tests vs Functional tests

提交回复
热议问题