cpp-testing

Guide GoogleTest/GoogleMock workflows in CMake/CTest projects for C++17/20.

Updated May 1, 2026
One-click install
npx skills add https://github.com/oguzhanguvenkaya/oguzhan_claude_code_configurations --skill cpp-testing-oguzhanguvenkaya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/oguzhanguvenkaya/oguzhan_claude_code_configurations/tree/main/skills/cpp-testing
Command: npx skills add https://github.com/oguzhanguvenkaya/oguzhan_claude_code_configurations --skill cpp-testing-oguzhanguvenkaya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

C++ projects often suffer from flaky tests and brittle test maintenance; this Skill provides a structured approach to writing, running, and diagnosing tests using GoogleTest/GoogleMock within a CMake/CTest workflow.

Core Features & Use Cases

  • Guidance for organizing tests into unit, integration, and fixture setups.
  • Clear TDD loop and best practices for using mocks vs fakes.
  • CI-friendly test discovery and reporting with CTest and gtest_discover_tests.
  • Real-world scenario: stabilizing a flaky suite in a modern C++17/20 project and adding coverage.

Quick Start

Run a minimal GoogleTest/CTest workflow to verify a failing or new C++ module with a CMake project.

Frequently Asked Questions about cpp-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I stabilize flaky GoogleTest suites in a CMake project?

Stabilize flaky GoogleTest suites by enforcing a TDD loop with proper fixtures and GoogleMock usage within a CMake/CTest workflow. This approach isolates dependencies, enforces clear test structure, and ensures appropriate use of mocks to diagnose and prevent intermittent failures.

What is the best way to configure CI pipelines for C++17/20 test discovery?

The best way to configure CI pipelines for C++17/20 test discovery is using CTest with gtest_discover_tests. This setup provides CI-friendly test discovery and reporting for your GoogleTest workflows, ensuring reliable execution across your modern codebase.

When should I use GoogleMock fakes versus mocks in my C++ tests?

You should use GoogleMock fakes versus mocks based on best practices for your test structure. The workflow guides the appropriate use of mocks and fakes, helping you organize tests into unit and integration setups while maintaining a clear TDD loop for your C++ project.

Does CTest work with GoogleTest for CI-friendly test reporting?

Yes, CTest works with GoogleTest by utilizing gtest_discover_tests for CI-friendly test discovery and reporting. This integration allows you to effectively run and diagnose tests within your CMake project, ensuring robust test coverage for your C++17/20 codebase.

How do I add coverage and sanitizers to a CMake CTest workflow?

You add coverage and sanitizers to a CMake CTest workflow by configuring appropriate options within your GoogleTest setup. This ensures robust test coverage and helps diagnose memory errors or undefined behavior in your C++17/20 modules during the TDD loop.