SKILL

cpp-testing

C++ テストの作成/更新/修正、GoogleTest/CTest の設定、失敗またはフレーキーなテストの診断、カバレッジ/サニタイザーの追加時にのみ使用します。

Original · translation is not supported for this source language

Target: Software development & testing. Automatically collected · unverified.

Excerpt from the author’s documentation

Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.

Read the original Japanese text

Topics in the source

  • C++ Testing(エージェントスキル)
  • 使用タイミング
  • 使用すべきでない場合
  • コア概念
  • TDD ワークフロー
  • コード例
  • 基本的なユニットテスト(gtest)
  • フィクスチャ(gtest)

CMake/CTest を使用した GoogleTest/GoogleMock による最新の C++(C++17/20)向けのエージェント重視のテストワークフローです。 新しい C++ テストの作成または既存のテストの修正 C++ コンポーネントのユニット/統合テストカバレッジの設計 テストカバレッジ、CI ゲーティング、リグレッション保護の追加 一貫した実行のための CMake/CTest ワークフローの設定 テスト失敗またはフレーキーな動作の調査 メモリ/レース診断のためのサニタイザーの有効化 テスト変更を伴わない新しい製品機能の実装 テストカバレッジや失敗に関連しない大規模なリファクタリング 検証するテストリグレッションのないパフォーマンスチューニング C++ 以外のプロジェクトまたはテスト以外のタスク TDD ループ: red → green → refactor(テスト優先、最小限の修正、その後クリーンアップ) 分離: グローバル状態よりも依存性注入とフェイクを優先 テストレイアウト: tests/unit、tests/integration、tests/testdata モック vs フェイク: 相互作用にはモック、ステートフルな動作にはフェイク CTest ディスカバリー: 安定したテストディスカバリーのために gtestdiscovertests() を使用 CI シグナル: 最初にサブセットを実行し、次に --output-on-failure でフルスイートを実行 RED → GREEN → REFACTOR ループに従います: 1. RED: 新しい動作をキャプチャする失敗するテストを書く 2. GREEN: 合格する最小限の変更を実装する 3. REFACTOR: テストがグリーンのままクリーンアップする 1. gtest フィルタで単一の失敗したテストを再実行します。 2. 失敗したアサーションの周りにスコープ付きログを追加します。 3. サニタイザーを有効にして再実行します。 4. 根本原因が修正されたら、フルスイートに拡張します。 グローバルフラグではなく、ターゲットレベルの設定を優先します。 GCC + gcov + lcov: Clang + llvm-cov: 同期に sleep を使用しないでください。条件変数またはラッチを使用してください。 一時ディレクトリをテストごとに一意にし、常にクリーンアップしてください。 ユニットテストで実際の時間、ネットワーク、ファイルシステムの依存関係を避けてください。 ランダム化された入力には決定論的シードを使用してください。 テストを決定論的かつ分離されたものに保つ グローバル変数よりも依存性注入を優先する 前提条件には ASSERT を使用し、複数のチェックには EXPECT を使用

This is an excerpt. Refer to the complete source and its current requirements.

Source repository
affaan-m/ECC
Source file
docs/ja-JP/skills/cpp-testing/SKILL.md
Fixed revision
d2ef2680594f9a17526a6e1a2e18b3d242c5d17b
Read the complete original documentation ↗

Sources and evidence

This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.

Author: affaan-m/ECC · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-09T14:01:49.080Z.

Categories are inferred from names, descriptions and paths. They do not establish compatibility.

License and attribution

MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.

Original license ↗

Synchronization, copying and user-reported success do not mark a resource as runtime-tested.

Limitations and notes

  • Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.