cpp-testing

Configure GoogleTest and GoogleMock with CMake and CTest for C++ testing.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill automates and standardizes the process of writing, running, and debugging tests for C++ projects, ensuring code quality and reliability.

Core Features & Use Cases

  • Test Writing & Fixing: Assists in creating new unit/integration tests and resolving existing test failures.
  • Configuration: Guides on setting up GoogleTest/GoogleMock with CMake/CTest for consistent test execution.
  • Debugging & Analysis: Provides strategies for diagnosing flaky tests and enabling coverage/sanitizers.
  • Use Case: When encountering a failing C++ test suite, this Skill can help identify the root cause, suggest fixes, and ensure the tests are robust.

Quick Start

Use the cpp-testing skill to write a new unit test for the calculate_sum function.

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?

To set up GoogleTest with CMake, you configure your CMakeLists.txt to link the GoogleTest libraries and register test executables with CTest. This integration ensures consistent test execution and automated discovery of unit and integration tests within your C++ project.

How do I generate C++ test coverage reports using gcov and lcov?

You generate C++ test coverage by compiling with coverage flags and utilizing gcov and lcov tooling. This process produces detailed reports indicating which code paths are exercised by your GoogleTest suite, helping you identify untested branches in your application.

Can I use sanitizers like AddressSanitizer with CTest?

Yes, you can integrate sanitizers such as AddressSanitizer (ASan), UndefinedBehaviorSanitizer (UBSan), and ThreadSanitizer (TSan) with CTest. Compiling your C++ test executables with sanitizer flags allows CTest to surface memory errors, undefined behavior, and data races during test execution.

What is the best way to debug a failing GoogleTest in C++?

The best way to debug a failing GoogleTest is to isolate the specific test case and utilize debugging strategies alongside sanitizer integration. Diagnosing the root cause involves checking for memory leaks with ASan or undefined behavior with UBSan to ensure your C++ tests are robust and reliable.

Does this C++ testing workflow support C++17 and C++20 projects?

Yes, this testing workflow explicitly supports C++17 and C++20 projects. It assists in the development, debugging, and maintenance of unit and integration tests tailored for these modern C++ standards, ensuring code quality and reliable test execution.