testing-standards

testing-standards is a cursor rule for Cursor from girijashankarj/cursor-handbook. It costs 543 tokens per session, scanned A, original, MIT.

A set of rules for writing and organizing tests, including coverage targets and a balance of unit, integration, and end-to-end tests. It also defines patterns for test structure, naming, mocks, and edge cases.

In plain words
What is it for?
Use it when adding tests or deciding how much of a codebase to test. It covers fast tests for individual functions, integration tests for services and databases, and end-to-end tests for key user flows.
Why use it?
It gives the coding agent consistent testing expectations, reducing missed error cases and tests that depend on real databases, files, or network services.

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/girijashankarj/cursor-handbook/testing-standards
Clone the repo
git clone --depth 1 https://github.com/girijashankarj/cursor-handbook

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

README.md
[![agentmods](https://agentmods.dev/badge/rules/girijashankarj/cursor-handbook/testing-standards.svg)](https://agentmods.dev/rules/girijashankarj/cursor-handbook/testing-standards)
Your own site
<a href="https://agentmods.dev/rules/girijashankarj/cursor-handbook/testing-standards"><img src="https://agentmods.dev/badge/rules/girijashankarj/cursor-handbook/testing-standards.svg" alt="Measured on agentmods" height="20"></a>
Per session 543 This file is loaded in full into every session.
When invoked 543 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.00543 $0.00543
Opus 5 $0.00271 $0.00271
Sonnet 5 $0.00109 $0.00109
Haiku 4.5 $0.00054 $0.00054

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

Security

Grade A, and why

testing-standards 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/testing/testing-standards.mdc · 74 lines

How it starts

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

Testing Standards

Coverage Requirements

  • Minimum coverage: {{CONFIG.testing.coverageMinimum}}%
  • Test command: {{CONFIG.testing.testCommand}}
  • Coverage command: {{CONFIG.testing.coverageCommand}}

Test Pyramid

Level Proportion Speed What to Test
Unit 70% Fast (<100ms) Functions, classes, utilities
Integration 20% Medium (<5s) API endpoints, DB queries, service interactions
E2E 10% Slow (<30s) Critical user flows only

Unit Test Rules

  • Test one thing per test case
  • Use descriptive test names: should {expected behavior} when {condition}
  • Follow Arrange-Act-Assert (AAA) pattern
  • Mock all external dependencies
  • No real network calls, database queries, or file I/O
  • Test edge cases: null, undefined, empty, boundary values
  • Test error cases as thoroughly as success cases
describe('OrderService', () => {
  describe('calculateTotal', () => {
    it('should return sum of item prices when items exist', () => {
      // Arrange
      const items = [{ price: 10 }, { price: 20 }, { price: 30 }];

      // Act
      const result = calculateTotal(items);

      // Assert
      expect(result).toBe(60);
    });

    it('should return 0 when items array is empty', () => {
      expect(calculateTotal([])).toBe(0);
    });

    it('should throw when items is null', () => {
      expect(() => calculateTotal(null)).toThrow('Items required');
    });
  });
});

Mock Rules

  • Use centralized mock infrastructure in tests/mocks/
  • Mock at the boundary — don't mock internal implementation
  • Keep mocks simple and maintainable
  • Reset mocks between tests
  • Never use real credentials in test fixtures

Integration Test Rules

  • Use test databases (not production)
  • Clean up test data after each test (or use transactions)
  • Test actual API contracts (request/response shapes)
  • Test error responses and status codes
  • Use factories/fixtures for test data creation

Read the full file on GitHub · 74 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 · 74 lines · 543 tokens per session scan A 7dc7b5cc5da2

Subscribe to this mod's changes

testing-standards is a cursor rule published in the GitHub repository girijashankarj/cursor-handbook (30 stars, last pushed 5d ago), licensed MIT. It adds 543 tokens to every session, about $0.0027 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-09-03.