cpp-testing

Develop C++ unit and integration tests with GoogleTest, GoogleMock, and CMake.

Updated Jan 30, 2026
One-click install
npx skills add https://github.com/ThejanaJayalath/Niolla-PM-system --skill cpp-testing-thejanajayalath
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/ThejanaJayalath/Niolla-PM-system/tree/main/.cursor/skills/cpp-testing
Command: npx skills add https://github.com/ThejanaJayalath/Niolla-PM-system --skill cpp-testing-thejanajayalath

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill addresses the complexity of maintaining high-quality C++ codebases by providing a standardized, automated workflow for unit testing, integration testing, and coverage analysis.

Core Features & Use Cases

  • Test Automation: Standardizes the RED-GREEN-REFACTOR TDD loop using GoogleTest and GoogleMock.
  • CI/CD Integration: Provides CMake configurations for CTest discovery, memory sanitizers (ASan/UBSan/TSan), and code coverage reporting.
  • Use Case: When refactoring a legacy C++ module, use this skill to generate a suite of unit tests and mock dependencies to ensure existing functionality remains intact while verifying new logic.

Quick Start

Use the cpp-testing skill to configure the current project for GoogleTest and run the full test suite with address sanitizers enabled.

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 for C++ unit testing, you need to configure CTest for automated test discovery and execution. This skill provides the necessary CMake configurations to standardize test automation and integrate it directly into your C++17/20 build environment.

What is the best way to run memory sanitizers on my C++ test suite?

The best way to run memory sanitizers on your C++ test suite is to execute your GoogleTest cases through CTest with AddressSanitizer, UndefinedBehaviorSanitizer, or ThreadSanitizer enabled. This skill facilitates memory safety diagnostics by providing the required CMake configurations for these sanitizers.

Can I use GoogleMock to test legacy C++ modules?

Yes, you can use GoogleMock to test legacy C++ modules by generating mock dependencies for external interactions. This skill supports isolating legacy code components, allowing you to verify that existing functionality remains intact while validating newly refactored logic.

How do I implement a TDD workflow in C++ using GoogleTest?

You implement a TDD workflow in C++ using GoogleTest by following the RED-GREEN-REFACTOR loop to write and validate tests iteratively. This skill standardizes the test-driven development process, ensuring consistent test creation and execution across modern C++17/20 environments.

Does CMake support automated code coverage reporting for C++ projects?

Yes, CMake supports automated code coverage reporting for C++ projects when configured alongside test frameworks like GoogleTest. This skill provides the necessary CMake configurations to generate automated code coverage reports, helping you maintain high-quality codebases.

Why are my C++ unit tests not discovering properly in CTest?

C++ unit tests may not discover properly in CTest if the CMake configurations are not standardized for the GoogleTest framework. This skill ensures consistent test discovery and execution by providing standardized CMake setups tailored for modern C++17/20 development environments.