cpp-testing

Automate C++ testing workflows with GoogleTest, GoogleMock, CMake, and CTest.

Updated Mar 20, 2026
One-click install
npx skills add https://github.com/KanakMalpani/General-Private-Skills --skill cpp-testing-kanakmalpani
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/KanakMalpani/General-Private-Skills/tree/main/skills/cpp-testing
Command: npx skills add https://github.com/KanakMalpani/General-Private-Skills --skill cpp-testing-kanakmalpani

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill guides engineers on writing, updating, and diagnosing C++ tests using GoogleTest/GoogleMock and CMake/CTest, delivering reliable, maintainable test suites.

Core Features & Use Cases

  • Establish a structured testing workflow (red → green → refactor) for C++ projects.
  • Provide templates and examples for unit tests, fixtures, mocks, and CI integration.
  • Show how to configure test discovery with CTest and run tests locally or in CI to ensure stability.

Quick Start

Add a basic GoogleTest example to your project and run the tests with ctest to verify the setup.

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

To set up C++ unit testing with GoogleTest, you configure CMake to discover and run tests via CTest, ensuring reproducible builds and clear test layouts. This workflow guides you through adding a basic GoogleTest example and running it locally to verify the setup.

What is the best way to structure a TDD workflow in C++ using GoogleMock?

The best way to structure a TDD workflow in C++ is following the red, green, refactor pattern using GoogleTest and GoogleMock. This approach provides templates for mocks and fixtures, ensuring maintainable test suites and reliable integration tests.

Can I use GoogleTest and CTest for CI integration in modern C++ projects?

Yes, you can use GoogleTest and CTest for CI integration in modern C++ projects. The workflow automates test discovery and execution within your CI pipeline, ensuring end-to-end test stability and reproducible builds across different environments.

How do I organize test data and fixtures for maintainable C++ GoogleTest suites?

You organize test data and fixtures for maintainable C++ GoogleTest suites by using standard patterns and structured test layouts. This Skill provides templates for fixtures and mocks, ensuring clear organization and reliable test data management.

Why does my CTest configuration fail to discover GoogleTest cases?

CTest configuration fails to discover GoogleTest cases when CMake is not properly configured to integrate GTest output. Ensure your CMake setup includes correct test discovery commands so CTest can reliably run and report your unit and integration tests.

Does the cpp-testing Skill support GoogleMock for creating mocks in C++ integration tests?

Yes, the cpp-testing Skill supports GoogleMock for creating mocks in C++ integration tests. It guides the creation and maintenance of mocks and fixtures, ensuring reliable end-to-end testing workflows within modern C++ projects.