A simple, expressive, header-only C++ mocking framework for unit testing with support for major compilers and testing frameworks.
FakeIt is a mocking framework for C++ that enables developers to create mock objects for unit testing. It simplifies testing by allowing easy setup of mock behavior, verification of method invocations, and integration with popular testing frameworks like Google Test and Boost Test. The library is header-only, requiring no separate compilation, and supports modern C++11 features.
C++ developers writing unit tests who need to mock dependencies, particularly those using testing frameworks such as GTest, MS Test, or Boost Test. It is suitable for projects requiring lightweight, expressive mocking without complex setup.
Developers choose FakeIt for its simplicity, single-header distribution, and broad compiler support. Its expressive API reduces boilerplate, and pre-configured integrations with major testing frameworks streamline test development, making it a practical choice for C++ unit testing.
C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Packaged as a single header file, it eliminates build dependencies and simplifies integration into any C++ project without complex setup.
Works with GCC, Clang, AppleClang, and MSVC across Linux, macOS, and Windows, ensuring cross-platform compatibility for diverse development environments.
Pre-configured for popular frameworks like GTest, MS Test, and Boost Test, reducing setup time and leveraging native assertion mechanisms for seamless output.
Uses Arrange-Act-Assert syntax and allows spying on existing objects in one line, enhancing test readability and flexibility without boilerplate code.
Cannot mock classes with multiple inheritance or virtual inheritance, limiting its use in complex object-oriented designs as admitted in the README limitations.
Mocks are not thread-safe, making it unsuitable for unit tests involving concurrent code or parallel execution, a noted drawback in the documentation.
Requires compilation with -O1 or -O0 on GCC, preventing higher optimization levels that might be needed for performance-sensitive testing or production-like builds.