51Testing软件测试论坛

标题: Mocks Aren't Stubs [打印本页]

作者: connie    时间: 2005-12-20 11:16
标题: Mocks Aren't Stubs
原文链接:http://www.martinfowler.com/articles/mocksArentStubs.html

Martin Fowler

The term 'Mock Objects' has become a popular one to describe special case objects that mimic real objects for testing. However the term mock was not originally meant as a more catchy name for stub, but to introduce a different approach to unit testing. In this article I dig into this difference of style to explain the difference between the interaction-based testing style favored by mock object fans, and the more usual state-based testing style.

Contents

State-Based Testing
Interaction-Based Tests
      Using EasyMock
The Difference Between Mocks and Stubs
Stylistic Consequences
      Fixture Setup
      Test Driven Development
      Test Isolation
      Coupling Tests to Implementations
      Design Style
So which style is the best?

[ 本帖最后由 connie 于 2005-12-20 11:18 编辑 ]




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2