Mocking frameworks allow you to replace a specific call to a class or method with a behavior you define. A mock object returns dummy data corresponding to some dummy input passed to it. Mock objects can be used as a replacement for real objects in unit testing, they often also record how they were used so that you can make assertions about this after the test has finished. When writing tests, developers often need to mock external libraries (e.g., database, network connections and etc.) to control the response from an external service. In C++, there are some good tools for this purpose.. These are the 5 best C++ Mock libraries CppUTes - unit testing and mocking framework for C/C; FakeIt - C++ mocking made easy; trompeloeil - Header only C14 mocking framework.
cpputestby cpputest
CppUTest unit testing and mocking framework for C/C++
cpputestby cpputest
C++
1217
Version:latest-passing-build
License: Permissive (BSD-3-Clause)
FakeItby eranpeer
C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.
FakeItby eranpeer
C++
1081
Version:2.3.2
License: Permissive (MIT)
trompeloeilby rollbear
Header only C++14 mocking framework
trompeloeilby rollbear
C++
708
Version:v44
License: Permissive (BSL-1.0)
mocxxby Guardsquare
A versatile C++ function mocking framework.
mocxxby Guardsquare
C++
113
Version:Current
License: Strong Copyleft (GPL-3.0)