cpp-testing

Automate C++ testing with GoogleTest and CMake/CTest workflows.

1|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/TruCol270/salty-pickle --skill cpp-testing-trucol270
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/TruCol270/salty-pickle/tree/main/.claude-skills/cpp-testing
Command: npx skills add https://github.com/TruCol270/salty-pickle --skill cpp-testing-trucol270

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured workflow for writing, configuring, and diagnosing C++ tests using GoogleTest/GoogleMock with CMake/CTest, ensuring reliable test coverage and CI readiness.

Core Features & Use Cases

  • Test scaffolding: set up unit and integration tests with standard layouts (tests/unit, tests/integration, tests/testdata).
  • CI-ready configuration: configure CTest, cap coverage, and enable sanitizers for memory/thread checks.
  • Debugging guidance: provide debugging approaches, fixtures, and mock patterns for test reliability.
  • Use Case: A developer wants to add a new unit test for a core utility and integrate it with a GitHub Actions workflow that runs the full test suite.

Quick Start

Initialize the C++ test project and add a sample unit test wired into CMake/CTest.

Frequently Asked Questions about cpp-testing

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

FAQPage Schema
How do I set up GoogleTest with CMake and CTest for C++ unit testing?

To set up GoogleTest with CMake, configure test executables in CMakeLists.txt and register them via add_test for CTest discovery. This skill guides scaffolding tests/unit and tests/integration directories, wiring GoogleTest binaries, and structuring project-wide test suites.

What's the best way to structure C++ integration and unit tests in a project?

The best way to structure C++ tests is separating them into tests/unit, tests/integration, and tests/testdata directories. This layout isolates test scopes, manages shared fixtures, and aligns with CTest configurations for targeted execution of specific test suites.

How do I enable AddressSanitizer and ThreadSanitizer in a CMake C++ testing workflow?

Enable AddressSanitizer and ThreadSanitizer by adding compiler flags like -fsanitize=address in your CMake configuration. This skill configures sanitizer-enabled workflows for C++ tests to perform automated memory and thread checks during CTest execution.

Can I use GoogleMock for debugging C++ test failures in CI pipelines?

Yes, you can use GoogleMock for debugging C++ test failures in CI pipelines by defining mock classes to isolate dependencies. This skill provides debugging approaches and mock patterns to ensure test reliability and validate interactions within CI-ready configurations.

Why is my GoogleTest suite not discovered by CTest in my C++ project?

GoogleTest suites are not discovered by CTest when CMake lacks add_test commands or test discovery scripts. Ensure your CMake configuration properly registers test executables and includes GoogleTest configuration helpers for automated CTest integration.