cpp-testing

Configure and debug GoogleTest/GoogleMock suites with CMake/CTest.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you write, fix, and harden C++ tests so failures are trustworthy, regressions are caught early, and CI runs stay fast and reliable.

Core Features & Use Cases

  • GoogleTest/GoogleMock workflows: create unit and integration tests, using fixtures plus mocks where interactions must be verified.
  • CMake/CTest execution and discovery: configure consistent builds and use gtest discovery for stable test registration.
  • Debugging, coverage, and sanitizers: diagnose failing or flaky tests, then add coverage signals and ASan/UBSan/TSan builds to catch hidden issues.
  • Use Case: when a change causes intermittent CI failures, use this workflow to reproduce the failing test with filters, enable sanitizers, and rework synchronization to eliminate nondeterminism.

Quick Start

Use the cpp-testing skill to fix failing or flaky C++ tests in your project by running the single failing test with a gtest filter, then iterating until the full CTest suite passes.

Frequently Asked Questions about cpp-testing

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

FAQPage Schema
How do I fix flaky C++ tests that fail intermittently in CI?

Fix flaky C++ tests by reproducing the failure with a gtest filter, enabling ASan or TSan builds to diagnose race conditions, and reworking synchronization to eliminate nondeterminism. This workflow ensures CI gating remains stable and trustworthy.

How do I run a single GoogleTest case with CMake and CTest?

Run a single GoogleTest case by configuring your build with CMake and using gtest_discover_tests for stable test registration, then execute the specific test by applying a gtest filter to your CTest command to isolate and iterate on individual failures.

When should I use ASan, UBSan, and TSan builds for C++ testing?

Use ASan, UBSan, and TSan builds when diagnosing hidden memory leaks, undefined behavior, or thread race conditions in your C++ test suites. These sanitizer-enabled builds provide root-cause analysis for flaky behavior and harden overall test determinism.

Does gtest_discover_tests work with CTest for test discovery?

Yes, gtest_discover_tests works with CTest to configure consistent builds and provide stable test registration. It integrates GoogleTest into CMake, allowing reliable test execution and filter-driven reruns without manual test list maintenance.

What is the best way to debug failing GoogleMock unit tests?

The best way to debug failing GoogleMock unit tests is to use fixtures and mocks to verify interactions, run the isolated test with a gtest filter, and add coverage instrumentation to capture hidden issues and validate code paths during root-cause analysis.