Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
I am pioneering unit testing efforts at my company, and need need to choose a mocking framework to use. I have never used a mocking framework before. We have already chosen Google Test, so using Google Mock would be nice. However, my initial impressions after looking at Google Mock s tutorial are:
- The need for re-declaring each method in the mocking class with a MOCK_METHODn macro seems unnecessary and seems to go against the DRY principle.
- Their matchers (eg, the _ in EXPECT_CALL(turtle, Forward(_));) and the order of matching seem almost too powerful. Like, it would be easy to say something you don t mean, and miss bugs that way.
I have high confidence in google s developers, and low confidence in my own ability to judge mocking frameworks, never having used them before. So my question is: Are these valid concerns?
Or is there no better way to define a mock object, and are the matchers intuitive to use in practice? I would appreciate answers from anyone who has used Google Mock before, and comparisons to other C++ frameworks would be helpful.