cpp-testing

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

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/ssrxs/scx-studio-pro-fixed --skill cpp-testing-ssrxs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/ssrxs/scx-studio-pro-fixed/tree/main/gemini-skills/ecc-cpp-testing
Command: npx skills add https://github.com/ssrxs/scx-studio-pro-fixed --skill cpp-testing-ssrxs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a complete guide for building and maintaining robust C++ tests using GoogleTest/GoogleMock and CMake/CTest, helping teams reduce flaky tests and stabilize CI.

Core Features & Use Cases

  • TDD workflow: red-green-refactor cycles with production code and tests.
  • Test scaffolding: unit/integration patterns, fixtures, mocks, and data setup for reliable tests.
  • CI readiness: integrates with test discovery, sanitizers, and coverage for CI pipelines.

Quick Start

Run a minimal test project with the included CMake/CTest setup to verify unit tests compile and run.

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?

GoogleTest with CMake uses gtest_discover_tests for automated test discovery and execution. Configure CMake to link GTest, register tests via CTest, and apply consistent test layouts to establish reliable C++ unit testing workflows.

What's the best way to integrate sanitizers into a C++ testing pipeline?

Sanitizers integrate into C++ testing by enabling compiler flags in CMake and running tests through CTest. This approach detects memory errors and undefined behavior during test execution, stabilizing CI pipelines across modern C++17/20 projects.

How do I use GoogleMock fixtures for test scaffolding in a TDD workflow?

GoogleMock fixtures provide structured test scaffolding by defining setup and teardown data for reliable tests. Use TDD red-green-refactor cycles to mock dependencies, write unit tests first, and drive production code implementation.

Does GoogleTest work with C++17 and C++20 projects?

GoogleTest works with modern C++17 and C++20 projects through standard CMake integration. It supports test discovery, sanitizers, and coverage integration, ensuring consistent test layouts and CI-ready patterns across these language standards.

Why are my C++ tests flaky in CI and how can CTest discovery help?

C++ tests become flaky in CI due to inconsistent test discovery and execution environments. Using gtest_discover_tests with CTest enforces structured test layouts, automated discovery, and sanitizer integration to reduce flakiness and stabilize pipelines.