test-strategy

Rules for designing and implementing software tests, including normal cases, failures, invalid inputs, and boundary values. Boundary values are inputs at or just beyond limits, such as zero, empty values, or maximum values.

In plain words
What is it for?
Use it when adding or changing tests, especially for validation, exceptions, external-service failures, and input limits.
Why use it?
It reduces missed edge cases by requiring a test-perspectives table and automated coverage for the listed scenarios.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/kinopeee/cursorrules/test-strategy
Clone the repo
git clone --depth 1 https://github.com/kinopeee/cursorrules

Made for: Cursor.

Per session 1,653 This file is loaded in full into every session.
When invoked 1,653 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01653 $0.01653
Opus 5 $0.00826 $0.00826
Sonnet 5 $0.00331 $0.00331
Haiku 4.5 $0.00165 $0.00165

Measured yesterday against content hash 278dff8f25a2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

test-strategy scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/test-strategy.mdc · 92 lines

How it starts

The opening of the file, as written. The whole thing — 92 lines — stays where its author put it; the contents beside it link to each section on GitHub.

テスト戦略ルール

これらのルールは、テストコードを実装または変更する際に必ず従うべきテストプロセスを定義する。以下のすべてのステップを満たさない限り、テストタスクは完了したとはみなされない。


1. テスト観点表(等価分割・境界値)

  1. いかなるテスト作業を開始する前にも、まず Markdown 形式の「テスト観点表(test perspectives table)」を提示しなければならない。
  2. 表には少なくとも次の列を含めること: Case ID, Input / Precondition, Perspective (Equivalence / Boundary), Expected Result, Notes
  3. 行は正常系・異常系・境界値のケースを網羅すること。境界値については、最低でも 0 / 最小値 / 最大値 / ±1 / 空 / NULL を含める。 境界値候補(0 / 最小値 / 最大値 / ±1 / 空 / NULL)のうち仕様上意味を持たないものは、Notes に対象外とする理由を記載したうえで省略してよい。
  4. 後から観点漏れに気づいた場合は、セルフレビュー後に表を更新し、必要なケースを追加すること。
  5. なお、既存テストの軽微な修正(メッセージ調整や期待値の微修正など)であり、新しい分岐や制約が追加されない場合は、テスト観点表の新規作成・更新は任意とする。

テンプレート例

Case ID Input / Precondition Perspective (Equivalence / Boundary) Expected Result Notes
TC-N-01 Valid input A Equivalence – normal Processing succeeds and returns expected value -
TC-A-01 NULL Boundary – NULL Validation error (required field) -
... ... ... ... ...

2. テストコード実装ポリシー

  1. 上記の表に記載したケースを すべて 自動化テストとして実装する。
  2. 正常系と同数以上の失敗系(バリデーションエラー、例外、外部依存失敗など)を必ず含める。
  3. 以下の観点をテストで網羅する:
    • 正常系(主要シナリオ)
    • 異常系(バリデーションエラー、例外パス)
    • 境界値(0, 最小, 最大, ±1, 空, NULL)
    • 不正な型・形式の入力
    • 外部依存の失敗(API / DB / メッセージング等が該当する場合)
    • 例外種別およびエラーメッセージ
  4. さらに、分岐網羅率 100% を目標にし、必要に応じて追加ケースを自ら設計する。 分岐網羅 100% は目標値とし、達成が合理的でない場合は、少なくともビジネスインパクトの高い分岐および主要なエラー経路を網羅すること。 未カバーとなる分岐がある場合は、その理由と影響を Notes や PR 本文に明示する。

3. Given / When / Then コメント

各テストケースには必ず以下のコメントフォーマットを付与する。

// Given: 前提条件
// When:  実行する操作
// Then:  期待する結果/検証

コメントはテストコード直上またはステップ内に記述し、読み手がシナリオを追えるように保つこと。


4. 例外・エラー検証

  1. 例外が発生するケースでは、例外のメッセージを明示的に検証する。
  2. バリデーション系の異常系では、エラーコードやフィールド情報があれば併せて確認する。
  3. 外部依存の失敗を模す場合は、スタブ/モックを利用して期待する例外・リトライ・フォールバックが呼ばれるかを確認する。

Read the full file on GitHub · 92 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 92 lines · 1,653 tokens per session scan A 278dff8f25a2

Subscribe to this mod's changes

test-strategy is a cursor rule published in the GitHub repository kinopeee/cursorrules (1,116 stars, last pushed 8mo ago), licensed MIT. It adds 1,653 tokens to every session, about $0.0083 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.