cpp-testing

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

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/YosefHayim/Template --skill cpp-testing-yosefhayim
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/YosefHayim/Template/tree/main/.cursor/skills/cpp-testing
Command: npx skills add https://github.com/YosefHayim/Template --skill cpp-testing-yosefhayim

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 code through modern testing practices.

Core Features & Use Cases

  • Test Development: Write new C++ tests or fix existing ones using GoogleTest and GoogleMock.
  • Configuration: Set up CMake/CTest for efficient test discovery and execution.
  • Debugging: Diagnose failing or flaky tests and implement coverage and sanitizers.
  • Use Case: You need to add unit tests for a new C++ module, ensuring it behaves as expected under various conditions and integrates seamlessly with your existing test suite.

Quick Start

Use the cpp-testing skill to write a new unit test for the Add function in src/add.cpp.

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 for C++ unit testing?

To set up GoogleTest with CMake, you configure CTest for automated test discovery and execution. This workflow streamlines writing and debugging C++ tests, ensuring your C++17/20 modules integrate reliably with your existing build system.

How do I diagnose flaky or failing C++ tests using GoogleTest?

To diagnose flaky or failing C++ tests, you use GoogleTest debugging workflows integrated with sanitizers and coverage analysis. This approach helps identify memory issues and untested code paths, ensuring robust and reliable test behavior across various conditions.

Can I integrate coverage and sanitizers into an existing C++ CMake build?

Yes, you can integrate coverage and sanitizers into an existing C++ CMake build. This configuration supports detecting memory leaks and verifying code paths, ensuring reliable test execution and robust code for C++17/20 projects.

What is the best way to add unit tests for a new C++ module?

The best way to add unit tests for a new C++ module is writing tests with GoogleTest and GoogleMock within a CMake build system. This ensures the module behaves as expected under various conditions and integrates seamlessly with your test suite.

Do I need CMake to use GoogleTest for C++ testing?

Yes, you need CMake to use this GoogleTest workflow for C++ testing. The configuration requires the CMake build system for test compilation and CTest for efficient test execution, specifically supporting C++17/20 project workflows.