Unit tests are necessary programs for checking the correctness of source code modules (e.g. classes). In object-oriented programming, objects interact with other objects to achieve a task. When writing unit tests for checking the interaction of the object-under-test with other objects, it is a useful technique to replace the objects with mock objects that share the same interface like the real objects. This allows the programmers to mimic the behaviour of the objects from the environment of the object-under-test. Mocking frameworks free the programmers from the tedious task of implementing mock objects.
  1. Wikipedia about mock objects
  2. List of C++ mocking frameworks in Wikipedia
The goal of this page is to evaluate existing mocking frameworks for C++.


Project page: http://code.google.com/p/googlemock/

  1. It is open source
  2. It is used in the Chromium projects.
  3. It is usable in Boost unit test (branches/kulas/mock_framework_evaluation/gmock/eval/PainterTest_boostUnitTest.cpp) and Google Test (branches/kulas/mock_framework_evaluation/gmock/eval/PainterTest_googleTest.cpp)
  1. It requires a compiled library
  2. It is mainly designed for use in Google Test, but Argos uses Boost unit test.


Project page: http://code.google.com/p/mockitopp/

  1. Similar to syntax of the popular mocking framework mockito
  1. Uses ABI technique for mocking objects. This might break if compiler changes implementation of look-up for virtual functions.
  2. Dead blog link (HTTP 404)
  3. Idle mailing list
  4. Invalid example on web page that does not match the trunk version of repository
  5. Example: branches/kulas/mock_framework_evaluation/mockitopp/eval/argument_matching.cpp


Project page: http://sourceforge.net/apps/mediawiki/turtle/index.php

  1. The user feedback is positive on the boost-user mailing list.
  2. No library linkage is necessary. The library comes with headers.
  3. It is integrated into Boost.Test.
  4. Syntax is fine: branches/kulas/mock_framework_evaluation/turtle/turtleEvaluation/turtleEvaluation.cpp
  5. The documentation is detailed
  1. Compilation speed seems to be slow.
Topic revision: r2 - 31 Jul 2018, AndrewColson
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback