Testing in C++
4 Topics
1
Google Test Fundamentals
Write unit tests in C++ using the Google Test (GTest) framework and manage assertions.
Differentiating between EXPECT_ and ASSERT_ assertions, and using test fixtures to share setup/cleanup logic.
2
Mocking with Google Mock
Isolate classes under test using GMock to write mocks, stubs, and expectations.
Using MOCK_METHOD macros, setting expectations before executions, and mock actions.
3
Setting Up Tests with CMake
Integrate Google Test and CTest into your project using CMake FetchContent modules.
Writing clean target-linking rules, using FetchContent for dependency management, and registering test targets in CTest.
4
Testing Best Practices for C++
Write clean, isolated, and maintainable C++ tests using AAA patterns and coverage metrics.
Ensuring test isolation, structure rules using the AAA pattern, and what metrics to track.