Setting Up GTest
Add and run the framework.
Why a Test Framework?
Google Test (GTest) is a widely used C++ unit-testing framework. It provides test registration, rich assertions, fixtures, and clear reporting so you can verify code automatically.
Getting GTest
Common ways to obtain GTest:
- System package (e.g.
libgtest-dev) - FetchContent in CMake pulling from GitHub
- A vendored submodule
FetchContent is the most portable for new projects.
All lessons in this course
- Setting Up GTest
- Assertions and Matchers
- Fixtures and Setup
- Mocking with GMock