SourceForge has been redesigned. Learn more.




Opmock 2.1 is out! Please checkout code from CVS and read the docs from the documentation folder, then try it out.
What's new : at last C++ code generation in addition to C code generation, new command line options, but be assured that all your existing tests are 100% compatible with the generated code!
Please report any issues!


Opmock is a mocking and testing tool for C and C++. It is useful if one wants to implement micro testing and TDD in a similar way of what exists in Java or C#. It is designed with legacy code in mind, and should work with all C++ and C compilers.

There are two main branches for Opmock. Releases 0.x were written in Java and made use of the SWIG tool for C/C++ parsing. This branch is now in maintenance mode. Bug fixes will be made, but no new functionalities will be added.

Opmock 2, the current release, is a work in progress, based on LLVM/Clang. Moving to Clang has the following advantages:

  • Can parse the full syntax of C and C++, something that was not possible before
  • Much faster for code generation
  • A single executable to install - no dependencies
  • Opens a wide field of future improvements like automated code refactoring and cleaning

NOTICE : Opmock 2 currently only process C header files. If you want to process C++ files,you can still use opmock 1.

Opmock 2 aims to be a drop in replacement of opmock 1, with full source and tests compatibility.
When the C++ part is complete, opmock 3 will break the API compatibility and introduce many new functionalities.

[Installing the binary release of Opmock 2]
[Installing Opmock 2 from the sources]
[Opmock 2 tutorial for C]
[Command line options]
[Advanced usages]
[Additional tools]
[Using Opmock with other unit testing frameworks]


Wiki: Additional tools
Wiki: Advanced usages
Wiki: Command line options
Wiki: Installing Opmock 2 from the sources
Wiki: Installing the binary release of Opmock 2
Wiki: Opmock 2 tutorial for C
Wiki: Using Opmock with other unit testing frameworks