Mocking frameworks comparison
You might have been redirected to this page.
Out with the old, in with the new
While ago I used to run this post series called “Mocking frameworks comparison” where I was comparing API of RhinoMocks, Moq and FakeItEasy. Long story short, it is no more.
Why have I decided to bury the series? I think we should be using modern frameworks, like FakeItEasy, Moq or NSubstitute. Comparing them with each other makes little sense as they are nearly identical both functionality-wise and syntax-wise (on top of that they all have excellent documentation and active community). Comparing them with RhinoMocks makes little sense as Rhino is old and no longer developed framework1 with often confusing syntax spanning across different version2.
Which framework to use?
The question remains. Rather than giving you straight answer I will answer a different question instead. Which framework you should stay away from? - RhinoMocks. Why?
- Its API is old, unpleasant and undocumented. It will make learning (it) harder and your tests will be more difficult to follow.
- It is no longer actively developed (regardless of recent attempts).
- It is one-man show (who might get bored and leave at some point).
- It is in alpha phase (since spring this year).
You do not want such library in your project. Rhino was excellent library but that was 5 years ago. Nowadays, there are simply better kids on the block (I am thinking FakeItEasy, Moq and NSubstitute). Use either of them. As for me, I stick with FakeItEasy as it is the exact opposite of Rhino’s don’ts3.