Mock framework for C++: an introductory flounder

In a prior project in Java, we used EasyMock as our mocking framework.  There were situations where being able to mock things really opened up the testing possibilities.  So today I looked around for what kind of mocking frameworks are available for C++.

On stackoverflow.com, someone asked about good mock frameworks for C++.  Four are listed:

AMOP
Googlemock (the video calls it gMock, but gMock seems to be for Groovy, not C++…)
HippoMocks
MockPP

The HippoMocks page points to these and some others:

MockitoPP
MockItNow
M0cxx0r
Moxy

First Impressions and Reasoning

I was first drawn to Googlemock because it might be well-implemented and better supported, being from Google.

But, it’s based on some kind of ugly looking macros.

AMOP doesn’t have the ugly looking macros.

But, it may have ugly-looking member function pointer syntax instead.

HippoMocks may have better syntax than either of the other two (need to check this).

And I appreciate how the author provides the links to other available mocking frameworks and a comparison between HippoMocks and the other frameworks, and the answers he gave on the Boost mailing list.

That’s all I know so far (and a little more!)

Advertisements

,

  1. #1 by Suleman Khalid on December 27, 2011 - 11:28 am

    Have u tried VoodooMock? It’s new and only at version 0.3. But it doesn’t require you to extract an interface for every class u mock!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s