cpp-testing

Configure C++ tests with GoogleTest, GoogleMock, CMake, and CTest.

1|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/aleonsa/claude-config --skill cpp-testing-aleonsa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/aleonsa/claude-config/tree/main/claude/skills/cpp-testing
Command: npx skills add https://github.com/aleonsa/claude-config --skill cpp-testing-aleonsa

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the process of writing, configuring, and debugging C++ tests, ensuring robust and reliable software development.

Core Features & Use Cases

  • Test Development: Write new C++ tests or fix existing ones using GoogleTest/GoogleMock.
  • Configuration: Set up CMake/CTest for consistent test execution and integrate coverage/sanitizers.
  • Debugging: Diagnose failing or flaky tests efficiently.
  • Use Case: When developing a new C++ feature, use this Skill to write comprehensive unit tests following a TDD approach, ensuring the feature works as expected before and after refactoring.

Quick Start

Use the cpp-testing skill to write a basic GoogleTest for a C++ function that adds two numbers.

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 a C++ project?

Set up GoogleTest with CMake and CTest by configuring CMakeLists.txt to discover tests and link GoogleTest libraries. This skill guides CMake/CTest integration, ensuring consistent test execution and automated discovery for C++17/20 projects.

How do I write isolated and deterministic unit tests in C++ using GoogleMock?

Write isolated and deterministic C++ unit tests using GoogleMock by creating mock classes for dependencies and adhering to TDD principles. This skill facilitates test creation by guiding best practices for isolated, deterministic test behavior.

What is the best way to integrate sanitizers and code coverage into a C++ testing workflow?

Integrate sanitizers and code coverage into your C++ testing workflow by configuring CMake build flags for AddressSanitizer and coverage tools. This skill addresses sanitizer setup and coverage integration to ensure robust debugging and reliable software development.

Why are my C++ GoogleTest tests flaky and how can I debug them?

Debug flaky C++ GoogleTest cases by diagnosing test isolation issues and state leakage using CTest. This skill helps diagnose failing or flaky tests efficiently by applying TDD principles and debugging best practices for reliable execution.

Can I use this C++ testing workflow for C++17 and C++20 projects?

Yes, you can use this C++ testing workflow for C++17 and C++20 projects. The skill explicitly addresses test creation, configuration, and debugging scenarios for C++17/20 projects using GoogleTest, GoogleMock, and CMake integration.

Does GoogleTest work with CTest for automated test execution in C++?

GoogleTest works with CTest for automated C++ test execution via CMake's test discovery mechanisms. This skill facilitates the integration of GoogleTest with CTest, ensuring consistent test execution and automated reporting across your development workflow.