Hippo mocks Uncategorized Hippomocks – use this framework in your projects

Hippomocks – use this framework in your projects

Hippomocks – use this framework in your projects post thumbnail image

The software development ecosystem grows at an incredible pace, with new frameworks and libraries being introduced constantly. In this race of technological evolution, it can be overwhelming for developers to keep abreast of the tools and frameworks to meet the project requirements. One such powerful tool that deserves the spotlight is the Hippomocks framework – a friendly mocking C++ library for unit testing.

In today’s blog post, we will explore the nitty-gritty of this amazing framework, discuss its strengths and limitations, and provide some food for thought on how you can utilize Hippomocks in your upcoming projects.

What is Hippomocks?

Hippomocks is an open-source C++ mocking framework created by Wouter van Ooijen initially for his personal use. Unit testing can become cumbersome when dealing with complex code structures and multiple interactions between objects. The fundamental concept behind mocking is to simulate specific parts during software or application processing to eliminate external dependencies and focus on testing a specific part of your code – isolating it from other dependencies (interconnected objects).

Using this framework allows developers to generate mock objects or functions that imitate real dependencies’ behavior, subsequently enabling the testing of scale, speed, stability, and efficiency.

Why Choose Hippomocks?

The primary reasons for considering Hippomocks over other popular C++ mocking libraries include its adaptable nature and minimal complexity, making it perfect for modern software projects with tight deadlines. Key features include:

1. No Required Dependencies: Hippomocks is completely self-sufficient – all you need is a compiler capable of understanding C++11 or later.
2. Ease-of-use: Using an intuitive syntax coupled with negligible boilerplate configuration code makes it easy to integrate into any project.
3. Cross-Platform Compatibility: Hippomocks can run on Windows (Visual Studio), Linux (GCC), and Mac OS X (Clang).
4. Supports Multiple Paradigms: It works in conjunction with various test paradigms, such as cppUnit or Google Test.

How to Use Hippomocks in Your Projects?

Although using Hippomocks only requires a basic understanding of its functionality, we’ll cover some practical steps to start implementing it with confidence:

1. Installation: Begin by downloading the source files from the project’s GitHub repository (https://github.com/dascandy/hippomocks). Afterward, include the “hippomocks.h” header file in your test classes.

2. Mock Object Creation: Use the “MockRepository” class provided by the framework to create mock objects by instancing it in your test suite.

3. Setup Expectations: Define how your mock objects should behave during testing using methods like ExpectCall().

4.Users Declaration: Tell Hippoomocks what function to call by setting up a user override method allowing mock functions access to its original environment.

5.Run Your Test Suite: Compile and run your test suite to check if everything works according to your expectations.


While well-suited for mid-sized projects due to its simplicity, you may face minor concerns strictly related to technical aspects that could impede development progress:

1. Lack of Comprehensive Documentation: Adequate documentation is part and parcel of a good framework; unfortunately, concise documents restrict access and hinder progress for some developers.
2. Restricted Support Updates: As this is predominantly a personal project, updates may be limited or infrequent than commercial frameworks.
3. Error Messages Complexity: If mistakes are made during testing setup configuration, error messages can appear complex and difficult to decipher.

Despite minor setbacks like rudimentary documentation and limited support updates – which necessitates a basic understanding of mocking principles – incorporating Hippomocks’ easy-to-understand syntax into new or existing projects efficiently reduces time spent troubleshooting configurations while providing consistent performance gains throughout testing. Moving forward with this lesser-known but powerful approach in C++ unit-testing ensures great project outcomes now and beyond!

Related Post