cpp-testing

Automate C++ test setup and execution with GoogleTest, CTest, and CMake.

16|9|Updated Nov 6, 2013
One-click install
npx skills add https://github.com/erikstmartin/dotfiles --skill cpp-testing-erikstmartin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/erikstmartin/dotfiles/tree/main/skills/catalog/cpp/cpp-testing
Command: npx skills add https://github.com/erikstmartin/dotfiles --skill cpp-testing-erikstmartin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps C++ teams automate and standardize their testing workflow using GoogleTest/CTest and CMake, reducing flaky tests and improving confidence in code changes.

Core Features & Use Cases

  • TDD-driven testing workflow with red–green–refactor loops for C++ projects.
  • Structured test organization guidance: unit, integration, and testdata layouts, plus test discovery via CTest.
  • CI-ready configuration and tooling guidance, including sanitizers and coverage options, to improve test reliability and visibility.
  • Practical code examples and quickstart guidance to bootstrap new test suites quickly.

Quick Start

Configure GoogleTest/CTest with CMake, build the tests, and run the test suite to validate your C++ code.

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 and CTest with CMake for C++ unit testing?

To set up C++ unit testing, you configure GoogleTest and CTest within your CMake build system, build the test targets, and run the suite to validate code. This workflow standardizes test discovery and execution across your project.

What is the best way to structure a TDD workflow for C++ projects using CMake?

A structured C++ TDD workflow uses red-green-refactor loops guided by CMake and GoogleTest. This approach organizes unit and integration tests systematically, ensuring reliable test coverage and consistent test data layouts.

Does this testing workflow support integration tests and mocks for C++ code?

Yes, the C++ testing workflow supports integration tests and mocks. It provides structured test organization guidance for unit, integration, and testdata layouts, ensuring comprehensive coverage and reliable validation of C++ components.

Can I integrate GoogleTest and CTest into a CI pipeline with sanitizers?

Yes, GoogleTest and CTest integrate into CI pipelines. The workflow provides CI-ready configuration and tooling guidance, including sanitizers and coverage options, to improve test reliability and visibility during automated builds.

How do I organize C++ test discovery using CTest workflows?

C++ test discovery using CTest workflows involves structuring unit, integration, and testdata layouts within your CMake configuration. CTest then automatically discovers and runs these structured tests to validate your code changes.