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.