testing-guidelines

testing-guidelines is a cursor rule for Cursor from ivangrynenko/cursorrules. It costs 2 tokens per session (529 once invoked), scanned A, original, MIT.

A set of guidelines for keeping production code separate from test code and making outside dependencies replaceable in tests.

In plain words
What is it for?
It guides test directory structure, controlled test hooks, dependency injection, mocks, and stubs for external services.
Why use it?
It makes tests easier to control and helps prevent testing changes from altering the running application.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/. Also seen: mentions Cursor.

Good fit It guides test directory structure, controlled test hooks, dependency injection, mocks, and stubs for external services.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/ivangrynenko/cursorrules/testing-guidelines
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/ivangrynenko/cursorrules

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-guidelines

README.md
[![agentmods](https://agentmods.dev/badge/rules/ivangrynenko/cursorrules/testing-guidelines/github.svg)](https://agentmods.dev/rules/ivangrynenko/cursorrules/testing-guidelines)
Your own site
<a href="https://agentmods.dev/rules/ivangrynenko/cursorrules/testing-guidelines"><img src="https://agentmods.dev/badge/rules/ivangrynenko/cursorrules/testing-guidelines/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-guidelines

Your own site · 80×15
<a href="https://agentmods.dev/rules/ivangrynenko/cursorrules/testing-guidelines"><img src="https://agentmods.dev/badge/rules/ivangrynenko/cursorrules/testing-guidelines.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 529 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00002 $0.00529
Opus 5.5 $0.00001 $0.00212
Sonnet 5.5 $0.00000 $0.00106
Haiku 4.5 $0.00000 $0.00053

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

Security

Grade A, and why

testing-guidelines 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.

.cursor/rules/testing-guidelines.mdc · 38 lines

What it actually says

Revised Cursor Rule File - Testing Guidelines (preserving functionality)

This file outlines testing policies that maintain existing functionality while incorporating best software testing practices.

It enforces separation of production and test code, allows controlled use of test hooks, and defines processes for exceptions and documentation alignment.

rules:

  • name: Test-Production Separation description: "Test code must remain strictly separated from production code." guidelines:
    • "Place test code in dedicated test directories or modules, separate from production code."
    • "Allow test-specific helpers or hooks only in a controlled manner (e.g., via clearly isolated interfaces or configurations)."
    • "Production code should remain unchanged for testing, unless using approved test extension points."
  • name: Testability (Mocks and Stubs) description: "Enable testability by using mocks and stubs for external dependencies." guidelines:
    • "Prefer dependency injection or interfaces to swap real components with mocks or stubs in tests."
    • "Avoid duplicating production logic in test code; tests should call into production code or use simplified mocks rather than reimplementing logic."
  • name: Exception Handling description: "Any necessary modification to production code for testing is an exception and requires review." guidelines:
    • "Document and justify any change made to production code solely for testing purposes."
    • "Obtain approval through a formal review process (e.g., code review by senior developers or architects) for such changes."
    • "Ensure that any approved change does not alter the intended functionality of the production code."
  • name: Documentation Alignment description: "Align test expectations with existing documentation without modifying production documentation." guidelines:
    • "Write tests to validate behaviors as documented in product or code documentation."
    • "If a test reveals a discrepancy between actual behavior and documentation, address it by updating the documentation via the normal process, not by changing production code to fit tests."
    • "Keep production code comments and descriptions unchanged during testing; refine tests or documentation instead to resolve mismatches."
  • name: Industry Best Practices description: "Follow industry best practices for software testing with clear boundaries." guidelines:
    • "Clearly delineate test types (unit, integration, end-to-end) and ensure each is executed in appropriate environments."
    • "Isolate tests to avoid side effects, and clean up any test data or state after execution."
    • "Integrate tests into continuous integration workflows to run automatically without requiring changes to production code."
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 · 38 lines · 2 tokens per session scan A 9f36243fee96

Subscribe to this mod's changes

testing-guidelines is a cursor rule published in the GitHub repository ivangrynenko/cursorrules (88 stars, last pushed 11mo ago), licensed MIT. It adds 2 tokens to every session and 529 once invoked, about $0.0000 per session on Opus 5.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-09-03.