cpp-testing

Write and configure C++ tests with GoogleTest, GoogleMock, and CMake.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/ryasrk/AgentBrokeTheMatrix-CopilotVersion --skill cpp-testing-ryasrk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/ryasrk/AgentBrokeTheMatrix-CopilotVersion/tree/main/.github/skills/cpp-testing
Command: npx skills add https://github.com/ryasrk/AgentBrokeTheMatrix-CopilotVersion --skill cpp-testing-ryasrk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the process of writing, configuring, and debugging tests for C++ projects, ensuring robust and reliable code.

Core Features & Use Cases

  • Test Development: Write new unit and integration tests using GoogleTest/GoogleMock.
  • Build Integration: Configure CMake/CTest for seamless test execution and discovery.
  • Debugging & CI: Diagnose failing tests, add coverage, and enable sanitizers for enhanced quality.
  • Use Case: When developing a new C++ feature, use this Skill to write corresponding unit tests, integrate them into the CMake build, and ensure they pass with coverage and sanitizers enabled before committing.

Quick Start

Use the cpp-testing skill to write a new GoogleTest for the calculate_average function in src/stats.cpp.

Frequently Asked Questions about cpp-testing

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

FAQPage Schema
How do I write a GoogleTest unit test for a C++ function?

To write a GoogleTest unit test in C++, you create test fixtures using GoogleTest and GoogleMock, define test cases, and integrate them into your build system to verify function behavior and reliability.

How do I integrate GoogleTest with CMake and CTest for automated test execution?

Integrating GoogleTest with CMake involves configuring CTest for test discovery and execution. You configure your CMakeLists.txt to link GoogleTest libraries, enabling seamless automated test running during your build process.

How do I debug failing C++ tests and enable sanitizers?

Debugging failing C++ tests and enabling sanitizers involves diagnosing test failures and activating sanitizer configurations to detect memory leaks and undefined behavior, ensuring enhanced code quality before committing.

Can I use GoogleMock for mocking dependencies in C++ integration tests?

Yes, you can use GoogleMock for mocking dependencies in C++ integration tests. It supports fixture creation and mocking to isolate components, allowing you to verify interactions within unit and integration testing workflows.

What is the best way to add code coverage reporting to a C++ CMake testing workflow?

Adding code coverage reporting to a C++ CMake testing workflow involves configuring your build to generate coverage data during test execution. This Skill facilitates setting up coverage alongside sanitizers to ensure robust test quality.

Do I need CMake and GoogleTest installed before setting up C++ property-based testing?

Yes, you need CMake, GoogleTest, and GoogleMock installed for build and execution. These dependencies are required to configure and run property-based testing, fixtures, and CMake integration workflows.