testing

testing is a cursor rule for Cursor from nedcodes-ok/cursor-doctor. It costs 797 tokens per session, scanned A, a copy of testing, MIT.

A set of guidelines for writing software tests: small checks that confirm code behaves as expected. It covers test structure, edge cases, errors, mocking, and coverage.

In plain words
What is it for?
Use it when planning unit and integration tests, naming scenarios, checking invalid input, testing boundary cases, and deciding what should or should not be mocked.
Why use it?
It helps tests reveal real user-facing bugs without becoming dependent on implementation details or on the order in which tests run.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it when planning unit and integration tests, naming scenarios, checking invalid input, testing boundary cases, and deciding what should or should not be mocked.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/nedcodes-ok/cursor-doctor/testing
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.

Clone the repo
git clone --depth 1 https://github.com/nedcodes-ok/cursor-doctor

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for testing

README.md
[![agentmods](https://agentmods.dev/badge/rules/nedcodes-ok/cursor-doctor/testing/github.svg)](https://agentmods.dev/rules/nedcodes-ok/cursor-doctor/testing)
Your own site
<a href="https://agentmods.dev/rules/nedcodes-ok/cursor-doctor/testing"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursor-doctor/testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for testing

Your own site · 80×15
<a href="https://agentmods.dev/rules/nedcodes-ok/cursor-doctor/testing"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursor-doctor/testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 797 This file is loaded in full into every session.
When invoked 797 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod 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.1 $0.00797 $0.00797
Opus 5.5 $0.00319 $0.00319
Sonnet 5.5 $0.00159 $0.00159
Haiku 4.5 $0.00080 $0.00080

Measured 1mo ago against content hash 0f564fdb9379, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

testing 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 1mo ago.

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.

Origin

This is a copy

100% identical to testing — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

pro-kit/templates/practices/testing.mdc · 43 lines

How it starts

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

Testing Rules

Test Structure

  • Arrange-Act-Assert: set up data → call the thing → check the result. Consistent structure makes every test scannable
  • One behavior per test — multiple assert calls checking the same behavior is fine (assertThat(user).hasName("Alice"); assertThat(user).isActive()). Multiple unrelated assertions is not
  • Test names describe the scenario and expectation: returnsNullWhenUserNotFound, throwsWhenEmailIsDuplicate — not test1, testUser, or shouldWork
  • Tests must be independent. If reordering tests breaks them, you have shared mutable state — a test that only passes after another test runs is two bugs

What to Test

  • Test behavior from the caller's perspective, not implementation details. "When I call createOrder with valid items, I get an order with the correct total" — not "createOrder calls calculateSubtotal then calls applyTax then calls saveToDb"
  • Edge cases are where bugs live: empty collections, zero/negative values, null/undefined, boundary values (off-by-one), Unicode, very long strings, concurrent access
  • Error paths are as important as happy paths — test that invalid input returns the right error, not just that valid input works
  • Don't test framework/library code. If you're testing that Array.sort() sorts, you're wasting time. Test YOUR code's behavior when it uses the sort result

Mocking Strategy

  • Mock at boundaries: HTTP clients, databases, file system, clocks, randomness — things that are slow, non-deterministic, or have side effects
  • Never mock the system under test. If you're mocking half the class to test the other half, the class is doing too much — split it
  • Prefer fakes over mocks when the boundary is complex: an in-memory repository that implements the same interface is more realistic than 20 mock configurations
  • Verify interactions only when the interaction IS the behavior: "send email to user" needs verify(emailService).send(...). "calculate total" does not need verify(calculator).add(...) — check the result instead
  • Mock return values for queries, verify calls for commands (CQS principle applied to test doubles)

Read the full file on GitHub · 43 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. 1mo ago First seen · 43 lines · 797 tokens per session scan A 0f564fdb9379

Subscribe to this mod's changes

testing is a cursor rule published in the GitHub repository nedcodes-ok/cursor-doctor (9 stars, last pushed 7mo ago), licensed MIT. It adds 797 tokens to every session, about $0.0032 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to testing, differing in 0 lines, and is treated as a copy.