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:
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.
I use it frequently.
It's trivial to do relatively easy things, and possible to do very difficult things - that's pretty much what I want from a framework.
The hardest part about writing custom Matchers (and other stuff) with Google's mocks isn't Google's mocks, it's C++'s template errors... they're close to impossible to parse. I often write complex expressions by incrementally building a working expression from a few less complicated expressions. That way, the template errors are easier to pinpoint.
I haven't seen a better option for c++ mocking, and Google's covers a lot of ground, so I'd suggest you give it a shot.
WRT the DRY principle, I agree the declaring the mocked methods is unfortunate, but without reflection, I'm not sure c++ would have much luck otherwise. I'm near certain if there were a way, googlemock would be using it ;)
BTW: The googlemock cookbook is a good reference.