The Mockpp Handbook




mockpp is a platform independent generic unit testing framework for C++. It's goal is to facilitate developing unit tests and integration tests in the spirit of Mock Objects for Java, EasyMock. and jMock.

Mock objects allow you to set up exactly predictable behaviour to help you test your production code by emulating some functionality your code depends on. This might for example be a huge database which is too difficult and time consuming to maintain just for testing purposes.

Table of Contents

1. Developer's Guide
1.1. Introduction
1.2. Basic Expectations
1.2.1. Expectation Value
1.2.2. Expectation List
1.2.3. Constraint List
1.2.4. Expectation Set
1.2.5. Expectation Map
1.2.6. Expectation Boundary
1.2.7. ExpectationCounter
1.2.8. TrackingCounter
1.2.9. ExpectationSegment
1.2.10. Return Object List
1.3. Advanced Expectations
1.3.1. Introduction to Advanced Mock Objects
1.3.2. Visitable Mock Objects
1.3.3. Chainable Mock Objects
1.3.4. Poor Man's Mock Objects
1.4. Helpers
1.4.1. Asserter
1.4.2. Formatter
1.4.3. Throwables
1.5. Choosing a Unit Test Framework
1.5.1. CppUnit
1.5.2. CxxTest
1.5.3. Boost.Test
1.5.4. Selecting a Framework at Compile Time
1.6. Working With Embedded Systems
1.6.1. The Problem
1.6.2. The Solution
1.7. Support for Production Code
1.7.1. Reproducible Time Values
1.7.2. Accessing protected elements
2. Automatically Create Mock Object Sources
2.1. Parsing The Header File
2.2. Generating The Mock Object Files
3. Frequently And Never Asked Questions
4. Credits and License
1. Installation
1.1. How to obtain mockpp
1.2. Compilation and Installation
1.2.1. Installing on systems using autoconf and friends
1.2.2. Installing on systems using Cygwin
1.2.3. Creating and Installing an RPM
1.2.4. Installing on other systems
1.2.5. Useful Scripts And Batch Files

List of Tables

1.1. Memory Consumption of C++ Code