Why do we need mocking frameworks?

后端 未结 11 1756
清歌不尽
清歌不尽 2020-12-30 03:00

I have worked with code which had NUnit test written. But, I have never worked with mocking frameworks. What are they? I understand dependency injection and how it helps to

11条回答
  •  孤独总比滥情好
    2020-12-30 03:11

    I first grok'd why I needed a mocking framework when I compared writing test doubles by hand for a set of unit tests (each test needed slightly different behaviour so I was creating subclasses of a base fake type for each test) with using something like RhinoMocks or Moq to do the same work.

    Simply put it was much faster to use a framework to generate all of the fake objects I needed rather than writing (and debugging) my own fakes by hand.

提交回复
热议问题