To write test doubles, we typically use an external library, just as we do with unit tests. Some of the most popular solutions are as follows:
- GoogleMock (also known as gMock), which is now a part of the GoogleTest library: https://github.com/google/googletest.
- Trompeloeil, which focuses on C++14, integrates well with many testing libraries, such as Catch2, doctest, and GTest: https://github.com/rollbear/trompeloeil.
The code in the following sections will show you how to use both GoogleMock and Trompeloeil.