An overview of unit testing terminology ( stub vs mock , integration vs. interaction )?

前端 未结 5 1397
温柔的废话
温柔的废话 2021-01-30 04:33

I\'m using more unit tests in my projects and reading all the information I can online and am getting confused by a lot of the terminology. As a result I\'m probably using these

5条回答
  •  说谎
    说谎 (楼主)
    2021-01-30 05:00

    This article from MSN Magazine explains the terms and goes into some detail with examples and some source code.

    Basically these are the test doubles:

    • Dummy - Dummies contain no implementation
    • Stub - stubs are minimal implementations of interfaces or base classes
    • Spy - a spy will record which members were invoked
    • Fake - more complex, a fake may resemble a production implementation
    • Mock - A mock is usually dynamically created by a mock library and depending on its configuration, a mock can behave like a dummy, a stub, or a spy

提交回复
热议问题