cpp-testing

Write and repair C++ tests using GoogleTest and CMake/CTest.

6|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/archibate/archibate-skills --skill cpp-testing-archibate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/archibate/archibate-skills/tree/main/old-skills/minor-skills/cpp-testing
Command: npx skills add https://github.com/archibate/archibate-skills --skill cpp-testing-archibate

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a focused workflow and guidance to write, repair, and stabilize unit and integration tests for modern C++ projects, reducing time spent on flaky failures, CI regressions, and inconsistent test discovery.

Core Features & Use Cases

  • Test authoring: Guidance for creating GoogleTest/GoogleMock unit and integration tests and organizing them under tests/unit and tests/integration.
  • Build and CI integration: Instructions to configure CMake targets, use gtest_discover_tests, and gate test runs in CI with reliable failure output.
  • Debugging & hardening: Steps to reproduce failures, enable sanitizers (ASan/UBSan/TSan), and add coverage collection with gcov/lcov or llvm-cov.
  • Flakiness mitigation: Best practices for isolating tests, using deterministic seeds, unique temp dirs, and avoiding sleep-based synchronization.

Quick Start

Use cpp-testing to write a GoogleTest for the failing function, add a test target and gtest_discover_tests to CMakeLists.txt, build with CMake, and run the test with ctest --output-on-failure.

Frequently Asked Questions about cpp-testing

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

FAQPage Schema
How do I write a GoogleTest for a failing C++ function and run it with CTest?

To write a GoogleTest for a failing C++ function, create a test case using GoogleTest/GoogleMock, add a test target with gtest_discover_tests to your CMakeLists.txt, build with CMake, and run the test using ctest --output-on-failure to see results.

What's the best way to fix flaky C++ tests in a CI pipeline?

Fix flaky C++ tests by isolating test cases, using deterministic seeds, generating unique temporary directories for each run, and avoiding sleep-based synchronization to ensure reliable execution in CI pipelines.

How do I configure CMake to collect test coverage for a C++ project?

Configure CMake test coverage by adding coverage targets to your build configuration and utilizing gcov/lcov or llvm-cov to collect and report coverage data for your C++ unit and integration tests.

How do I enable sanitizers to debug failing GoogleTest cases locally?

Debug failing GoogleTest cases by enabling sanitizers such as ASan, UBSan, and TSan in your CMake build configuration to detect memory errors and undefined behavior when reproducing failures locally.

Does cpp-testing work with modern C++17 and C++20 codebases?

Yes, cpp-testing applies to modern C++17 and C++20 codebases, providing focused workflows and guidance for writing, repairing, and stabilizing unit and integration tests for these project environments.

How should I organize GoogleTest unit and integration tests in a C++ project?

Organize GoogleTest unit and integration tests by structuring them under the tests/unit and tests/integration directories to maintain a clear separation of test scopes within your C++ project.