cpp-testing

Develop and execute C++ tests with GoogleTest and CTest.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and 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++ unit and integration tests using GoogleTest/GoogleMock.
  • Workflow Configuration: Set up CMake/CTest for consistent test execution and discovery.
  • Debugging & Optimization: Diagnose failing tests, enable sanitizers (ASan, UBSan, TSan), and implement code coverage.
  • Use Case: You've just implemented a new feature in your C++ application and need to write comprehensive unit tests for it, configure CMake to build and run them, and ensure they pass in your CI pipeline.

Quick Start

Use the cpp-testing skill to write a new GoogleTest for the calculate_sum function in src/calculator.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 and CTest for my C++ project?

GoogleMock allows you to create mocks for C++ unit testing, isolating dependencies to verify specific interactions. This skill supports mocking with GoogleMock, enabling you to write comprehensive integration and unit tests for complex C++ applications.

Can I use sanitizers like ASan and UBSan to debug failing C++ tests?

Yes, you can use sanitizers like ASan, UBSan, and TSan to debug failing C++ tests. This skill helps diagnose failing tests by enabling memory and thread safety sanitizers, allowing you to identify undefined behavior and memory leaks during test execution.

What's the best way to implement code coverage for C++ GoogleTest suites?

The best way to implement code coverage for C++ GoogleTest suites is to configure your build system to track execution paths. This skill supports implementing code coverage, helping you identify untested code paths after running your CTest workflows.

Why does my CTest configuration fail to discover new GoogleTest cases?

CTest configuration fails to discover new GoogleTest cases when CMake is not properly configured to parse and register the test executable. This skill addresses CMake/CTest configuration issues, ensuring consistent test discovery and execution for your C++ project.

Do I need to manually create test fixtures for GoogleTest or can they be generated?

You need to create test fixtures for GoogleTest to set up common test scenarios, and this skill facilitates their creation. It helps you structure test fixtures properly, ensuring reusable and maintainable test setups for your C++ unit testing workflows.