cpp-testing

Diagnose and fix failing C++ tests with CMake/CTest pipelines.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/Maelwalser/claude-config --skill cpp-testing-maelwalser
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/Maelwalser/claude-config/tree/main/skills/cpp-testing
Command: npx skills add https://github.com/Maelwalser/claude-config --skill cpp-testing-maelwalser

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill reduces the time and uncertainty spent diagnosing failing or flaky C++ tests, configuring reproducible CMake/CTest pipelines, and adding coverage or sanitizer-based diagnostics so teams can quickly find and fix regressions.

Core Features & Use Cases

  • Test diagnosis: guidance on rerunning failing tests, using gtest filters, and isolating flaky behavior.
  • CMake/CTest integration: best practices for gtest_discover_tests, target-scoped test targets, and CI-friendly execution.
  • Coverage & sanitizers: instructions for enabling GCC/Clang coverage builds and ASan/UBSan/TSan configurations for CI.
  • TDD & test layout: recommended red→green→refactor workflow, test directory conventions, fixtures, and mock vs fake guidance.
  • Use Case: reproduce a flaky unit test locally with sanitizers enabled, isolate the cause, and add deterministic seeds or fixes before merging.

Quick Start

Run the failing test locally with ctest or the gtest filter in a Debug build with sanitizers enabled to reproduce and investigate the failure.

Frequently Asked Questions about cpp-testing

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

FAQPage Schema
How do I run a specific failing GoogleTest in CMake using CTest?

Isolate flaky C++ test behavior by rerunning failing GoogleTest cases with gtest filters via CTest. This approach isolates specific tests within your CMake pipeline to reproduce and investigate failures locally before merging changes.

How do I configure CMake and CTest for CI-friendly test pipelines?

Configure CI-friendly CTest pipelines by using gtest_discover_tests and target-scoped test targets. This integration ensures reproducible test runs and reliable CI gating for C++17/20 codebases using GoogleTest.

What is the best way to enable ASan and UBSan in a C++ test build?

Enable ASan and UBSan in your C++ test build by configuring GCC or Clang sanitizer options for CI. Running failing tests locally with sanitizers activated helps quickly isolate memory errors and undefined behavior causing regressions.

How do I add code coverage to a CMake C++ testing workflow?

Add code coverage to your C++ testing workflow by enabling GCC or Clang coverage builds. This provides diagnostic data on test execution paths, helping teams identify untested code and fix regressions efficiently.

Does this C++ testing workflow support mocks and fakes in GoogleMock?

Yes, this C++ testing workflow supports mocks and fakes using GoogleMock. It provides guidance on test directory conventions, fixtures, and choosing between mock versus fake implementations for reliable unit and integration testing.

Why are my GoogleTest tests flaky and how can I make them deterministic?

Flaky GoogleTest behavior is diagnosed by running tests in a Debug build with sanitizers to reproduce the issue. Once isolated, you add deterministic seeds or fixes to ensure reproducible test runs before merging.