cpp-testing

Build, update, and diagnose C++ tests with GoogleTest and CMake.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/lllooollpp/solopreneur- --skill cpp-testing-lllooollpp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-testing
Source: https://github.com/lllooollpp/solopreneur-/tree/main/solopreneur/data/skills/cpp-testing
Command: npx skills add https://github.com/lllooollpp/solopreneur- --skill cpp-testing-lllooollpp

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps C++ teams write, update, and diagnose tests, configure GoogleTest/CTest, and maintain reliable test coverage with sanitizers.

Core Features & Use Cases

  • TDD workflow guidance for C++ projects using GoogleTest/GoogleMock and CMake/CTest.
  • Test structure conventions including tests/unit, tests/integration, and tests/testdata for clear organization.
  • Practical examples covering basic unit tests, fixtures, mocks, and CI-ready test discovery via gtest_discover_tests.
  • CI integration & sanitizers with memory and thread sanitizers to catch issues early in the development cycle.
  • Adoption scenarios such as adding a new test, wiring it into the build, and running the full/filtered test suite.

Quick Start

Create a new test under tests/unit, configure CMake to include tests, and run the test suite with 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 my C++ project?

Structure GoogleTest projects using tests/unit, tests/integration, and tests/testdata directories. This convention separates unit, integration, and behavior tests, providing clear test organization and easier maintenance across C++ projects.

Can I use GoogleMock for mocking and fixtures in my C++ unit tests?

Integrate sanitizers like memory and thread sanitizers into your C++ test workflow to catch memory leaks and data races early. This provides safer CI pipelines by detecting undefined behavior during automated test execution.

What's the best way to organize C++ test files for unit and integration testing?

Set up GoogleTest with CMake by configuring your build system to include tests, structuring directories like tests/unit, and running the suite with ctest. This provides CI-ready test discovery using gtest_discover_tests.

How do I run a filtered C++ test suite using CTest?

Follow TDD workflow guidance for C++ projects using GoogleTest and CMake to write, update, and diagnose tests. This ensures robust test coverage by establishing test structure conventions and CI-ready discovery from the start.

Does GoogleTest support CI integration with memory and thread sanitizers?

Use GoogleMock for mocking and fixtures in C++ unit tests to isolate components and define reusable test setups. This supports robust test coverage by enabling behavior verification and consistent test preconditions.

How do I add a new GoogleTest unit test and wire it into my CMake build?

Run a filtered C++ test suite using CTest by wiring tests into your CMake build and executing specific test patterns. This enables targeted test execution, helping engineers diagnose and update tests efficiently without running the entire suite.