cpp-testing

Automate C++ unit test setup and execution with GoogleTest and CTest.

12|4|Updated Mar 22, 2026
One-click install
npx skills add https://github.com/TeiNam/kiro-with-harness --skill cpp-testing-teinam
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/TeiNam/kiro-with-harness/tree/main/skills/cpp-testing
Command: npx skills add https://github.com/TeiNam/kiro-with-harness --skill cpp-testing-teinam

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill simplifies the process of writing, updating, and fixing C++ tests, configuring testing environments, and diagnosing test failures.

Core Features & Use Cases

  • Testing Workflow: Offers a structured approach to TDD, including writing failing tests, implementing solutions, and refactoring.
  • Integration with CMake/CTest: Provides guidance on setting up CMake/CTest for consistent test execution.
  • Sanitizers and Coverage: Instructs on enabling sanitizers for memory and race diagnostics and setting up coverage tools.
  • Use Case: Ideal for C++ developers looking to establish a robust testing framework for their projects, especially when working with GoogleTest/GoogleMock.

Quick Start

Use the cpp-testing skill to set up a new C++ test project with GoogleTest and CTest.

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 a C++ project?

To set up GoogleTest with CMake, you configure CTest as the test runner and link the GoogleTest library to your C++ targets. This provides a structured environment for consistent test execution and automated discovery.

What is the best way to start test-driven development in C++?

Test-driven development in C++ involves a structured workflow of writing failing tests first, implementing the minimal solution, and then refactoring. Using GoogleTest and GoogleMock helps isolate dependencies and verify behavior at each stage.

Do I need C++17 or C++20 knowledge to use GoogleTest effectively?

Yes, familiarity with C++17 and C++20 features is required to effectively write and maintain GoogleTest suites. Modern C++ standards are integral to structuring mocks, fixtures, and type-safe test assertions.

How do I enable sanitizers for C++ memory and race condition diagnostics?

To enable sanitizers, you configure specific compiler flags within your CMake build system. This injects runtime checks into your GoogleTest executable, allowing you to diagnose memory leaks and race conditions during test execution.

Why are my GoogleTest fixtures failing to compile in CMake?

GoogleTest fixtures often fail to compile in CMake due to missing library links or incorrect C++17 standard configurations. Diagnosing these test failures requires verifying target dependencies and matching your test setup with the expected build outputs.