cpp-testing

Automate C++ testing workflows with GoogleTest/CTest, including setup, configuration, and test execution.

Updated Mar 19, 2026
One-click install
npx skills add https://github.com/RUSHYOP/imperium-cli --skill cpp-testing-rushyop
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/RUSHYOP/imperium-cli/tree/main/content/skills/cpp-testing
Command: npx skills add https://github.com/RUSHYOP/imperium-cli --skill cpp-testing-rushyop

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing, updating, and maintaining robust C++ tests across GoogleTest/CTest-enabled projects can be repetitive and error-prone. This skill provides guidance on structuring tests, configuring CMake/CTest, and integrating sanitizers to ensure reliable test results.

Core Features & Use Cases

  • Test layout guidance for unit, integration, and data-driven tests with GoogleTest/GoogleMock, including source and test directories.
  • Configuration patterns for GoogleTest discovery, CTest integration, and CI gating to ensure fast feedback and reproducibility.
  • Sanitizer and coverage setup examples to detect memory errors, race conditions, and to measure test coverage in CMake-based projects.

Quick Start

Initialize a C++ testing workflow by configuring GoogleTest/CTest in your CMake project and running the first test suite.

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++ testing?

C++ testing with GoogleTest and CTest involves structuring unit, integration, and data-driven tests using GoogleMock, then configuring CMake with gtest_discover_tests() to register and execute them, ensuring fast feedback and reproducible results.

How do I configure AddressSanitizer and coverage flags in a CMake-based C++ project?

You configure sanitizers and coverage in a CMake-based C++ project by adding compiler flags to detect memory errors and race conditions, and by setting up coverage measurement tools, ensuring reliable test results through CTest integration.

What is the best way to structure GoogleTest directories for unit and integration tests?

The best way to structure GoogleTest directories is to separate source and test directories, organizing unit, integration, and data-driven tests logically to streamline maintenance and CTest discovery across your C++ project.

Can I use CTest to gate continuous integration for GoogleTest results?

Yes, you can use CTest to gate continuous integration by configuring CI gating patterns that execute GoogleTest suites via CTest, ensuring fast feedback and reproducible test results before merging C++ code changes.

Why does gtest_discover_tests fail to find my C++ test binaries?

gtest_discover_tests() may fail to find C++ test binaries if the CMake target dependencies are misconfigured or if the test binary execution environment lacks the necessary runtime libraries, preventing CTest from properly registering the tests.