cpp-testing

Automate C++ unit and integration tests with GoogleTest and CMake.

Updated Jul 8, 2026
One-click install
npx skills add https://github.com/nazrulsoftwaredev/NIT_CRM_2 --skill cpp-testing-nazrulsoftwaredev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/nazrulsoftwaredev/NIT_CRM_2/tree/main/.agents/skills/cpp-testing
Command: npx skills add https://github.com/nazrulsoftwaredev/NIT_CRM_2 --skill cpp-testing-nazrulsoftwaredev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

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

Core Features & Use Cases

  • TDD Workflow Integration: Implements the red-green-refactor cycle for C++17/20 projects.
  • Test Framework Configuration: Provides templates for GoogleTest, GoogleMock, and CTest integration.
  • Diagnostic Support: Includes configurations for sanitizers (ASan, UBSan, TSan) and code coverage reporting (gcov/lcov/llvm-cov).
  • Use Case: Use this skill to set up a new test suite for a C++ component, ensuring that memory leaks and race conditions are caught early through automated sanitizer builds.

Quick Start

Use the cpp-testing skill to configure a new GoogleTest suite and run the build 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 and CMake for a C++ project?

To set up GoogleTest and CMake, you configure CTest integration and use provided templates for GoogleTest and GoogleMock. This automates unit and integration test execution, ensuring deterministic test discovery and robust regression testing for modern C++ development environments.

Can I use address sanitizers with GoogleTest in CMake?

Yes, you can enable address sanitizers with GoogleTest in CMake. The configuration includes diagnostic support for ASan, UBSan, and TSan, allowing automated sanitizer builds to catch memory leaks and race conditions early during C++ test execution.

What's the best way to generate code coverage reports for C++ unit tests?

The best way to generate C++ code coverage reports is by configuring gcov, lcov, or llvm-cov within your CMake build system. This integration analyzes test execution paths and outputs coverage metrics to evaluate the robustness of your unit and integration tests.

How do I implement mock objects for C++ integration testing?

You implement mock objects for C++ integration testing using GoogleMock templates integrated with your CMake configuration. This setup automates mock object implementation and test discovery, satisfying requirements for deterministic test execution within complex C++ component interactions.

Does this testing workflow support TDD for C++17 and C++20?

Yes, this testing workflow supports TDD for C++17 and C++20 projects by implementing the red-green-refactor cycle. It automates test creation and execution using GoogleTest and CMake, ensuring robust regression testing and memory safety diagnostics throughout the development lifecycle.