cpp-testing

Debug failing and flaky C++ tests with GoogleTest and CMake/CTest.

1|Updated Mar 3, 2026
One-click install
npx skills add https://github.com/samymity/bridge-ventures-backend --skill cpp-testing-samymity
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/samymity/bridge-ventures-backend/tree/main/.claude/skills/cpp-testing
Command: npx skills add https://github.com/samymity/bridge-ventures-backend --skill cpp-testing-samymity

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps you diagnose and repair failing or flaky C++ tests by providing an end-to-end, reproducible workflow for GoogleTest/GoogleMock integrated with CMake/CTest.

Core Features & Use Cases

  • Failure triage and stabilization: isolate the failing test, reproduce with filters, and reduce nondeterminism sources that cause flakiness.
  • Consistent CMake/CTest setup: configure deterministic test discovery (including gtest_discover_tests) and CI-friendly execution.
  • Quality signals: enable sanitizers (ASAN/UBSAN/TSAN) and add coverage instrumentation to find memory, concurrency, and untested paths.
  • When to use: unit/integration test authoring, regression protection, and debugging unreliable test behavior in modern C++ (C++17/20).

Quick Start

Use the cpp-testing skill to configure your CMake/CTest test discovery and then rerun only the failing GoogleTest(s) with --output-on-failure until the underlying issue is fixed.

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 GoogleTest tests in my C++ project?

Fix flaky GoogleTest tests by isolating the failing test, reproducing with gtest filters, and removing time, network, or sleep-driven nondeterminism sources. This workflow enforces RED→GREEN→REFACTOR discipline and uses CTest to rerun only the failing tests until stable.

How do I configure CMake and CTest for deterministic GoogleTest discovery?

Configure deterministic GoogleTest discovery in CMake by using gtest_discover_tests to register tests at build time instead of runtime. This CI-friendly setup ensures consistent test execution and allows rerunning specific failing tests with --output-on-failure.

What causes flaky C++ tests and how do sanitizers help debug them?

Flaky C++ tests often stem from memory, concurrency, or undefined behavior issues. Enable sanitizers like ASAN, UBSAN, and TSAN during test builds to detect hidden memory leaks, data races, and untested paths that cause unreliable test behavior.

Can I use this workflow for both unit and integration testing in modern C++?

Yes, this workflow supports both unit and integration test authoring in modern C++ (C++17/20). It guides GoogleTest and GoogleMock usage with CMake/CTest, helping you write coverage, protect against regressions, and debug unreliable test behavior in CI.

Why does my C++ test pass locally but fail in CI?

C++ tests passing locally but failing in CI usually indicate hidden nondeterminism from sleep calls, network dependencies, or race conditions. Isolate the test with gtest filters, enable sanitizer instrumentation, and rerun with --output-on-failure to reproduce and fix the regression.