agentleFS
irahardiantoirahardianto/awesome-agv/.agents/skills/testing-strategy/SKILL.md

testing-strategy

Skill157 starsChanged 3 months agoMITView on GitHub

Detailed testing reference material: test doubles strategy, integration test infrastructure (Testcontainers, Firebase emulator), naming conventions per language, test organization patterns. Load when writing tests or setting up test infrastructure. The core mandates (TDD, AAA, pyramid) are in the testing-strategy rule — this skill provides implementation details.

37 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use react-patterns, api-design and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • benshapyroSkill

    react-patterns

    Modern React patterns for TypeScript applications including hooks, state management, and component composition. Use when building React components, managing state, or implementing React best practices.

    Also in 4 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 10 projects that use this

  • OpenAISkill

    observability

    Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.

    Also in 5 projects that use this

  • Microsoft AzureSkill

    git-workflow

    Squad branching model: dev-first workflow with insiders preview channel

    Also in 6 projects that use this

  • MicrosoftSkill

    error-handling

    统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。

    Also in 3 projects that use this

  • CloudAI-XSkill

    database-design

    Designs database schemas, indexing strategies, query optimization, and migration patterns for SQL and NoSQL databases. Use when designing tables, optimizing queries, fixing N+1 problems, planning migrations, or when asked about database performance, normalization, ORMs, or data modeling.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 6 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 33 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Unit Tests: Use mocks/stubs for all driven ports

    line 19
  2. Distinctive:

    Integration Tests: Use real infrastructure

    line 25
  3. Distinctive:

    Test actual database queries, connection handling, transactions

    line 28
  4. Distinctive:

    Verify adapter implementations work with real services

    line 29
  5. Distinctive:

    Test adapter (in-memory, fake implementation)

    line 33
  6. Distinctive:

    Place tests next to the file they test.

    line 38
  7. Very specific:

    Place in a dedicated e2e/ folder:

    line 60
  8. Very specific:

    Test doubles co-location: Place mocks next to interface (e.g., storage_mock.go, taskAPI.mock.ts)

    line 93

“Common” is measured: kept by at least 6 in 10 of the 33 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Testing Strategy Skill

This skill provides detailed implementation guidance for testing. The core mandates (TDD, AAA, test pyramid ratios) are in the testing-strategy rule and are always active. Load this skill when you need specific patterns, tools, or language conventions.

Test Doubles Strategy

Unit Tests: Use mocks/stubs for all driven ports

  • Mock repositories return pre-defined data
  • Mock external APIs return successful responses
  • Mock time/random for deterministic tests
  • Control test environment completely

Integration Tests: Use real infrastructure

  • Testcontainers spins up PostgreSQL, Redis, message queues
  • Firebase emulator spins up Firebase Authentication, Cloud Firestore, Realtime Database, Cloud Storage for Firebase, Firebase Hosting, Cloud Functions, Pub/Sub, and Firebase Extensions
  • Test actual database queries, connection handling, transactions
  • Verify adapter implementations work with real services

Best Practice: Generate at least 2 implementations per driven port:

  1. Production adapter (PostgreSQL, GCP GCS, etc.)
  2. Test adapter (in-memory, fake implementation)

Test Organization

Co-located Tests (Unit & Integration)

Place tests next to the file they test. This keeps tests visible, encourages maintenance, and supports refactoring.

Naming Conventions by Language:

LanguageUnitIntegration
TS/JSframework-dependent — see note belowframework-dependent
Go*_test.go*_integration_test.go
Dart/Flutter*_test.dart (in test/ mirroring lib/)*_integration_test.dart
Pythontest_*.pytest_*_integration.py
Java*Test.java*IT.java
Rust#[cfg(test)] mod tests inlinetests/ at crate root

TS/JS test-naming is framework-dependent, not a single suffix. Authoritative rule: @.agents/skills/typescript-idioms/references/project-structure.md §Test Organization. Summary: Vue & Angular use *.spec.ts (CLI default); React uses *.test.tsx; generic TS, Hono, and Next.js App Router use *.test.ts (Next.js co-locates in __tests__/). Do not mix test and spec suffixes within a single package — follow that package's framework convention.

Language-Specific Overrides

Flutter: Tests live in test/ mirroring lib/ layout (Flutter's default convention, discovered by flutter test). See the flutter-idioms skill's project-structure reference.

Rust: Unit tests are inline (#[cfg(test)] mod tests at the bottom of each .rs file). This is the official Rust convention — it enables testing private functions and is how cargo test discovers unit tests. Integration tests go in tests/ at the crate root, compiled as separate crates. See the rust-idioms skill.

E2E Tests (Separate)

Place in a dedicated e2e/ folder:

  • Single app: e2e/ at project root
  • Monorepo: apps/e2e/ subdivided by scope: apps/e2e/api/ and apps/e2e/ui/
  • Naming: {feature}-{ui/api}.e2e.test.{ext}

For interactive E2E testing, see the browser-automation skill.

Test Quality Standards

AAA Pattern Example:

// Arrange: Set up test data and mocks
const user = { id: '123', email: 'test@example.com' };
const mockRepo = createMockRepository();

// Act: Execute the code under test
const result = await userService.createUser(user);

// Assert: Verify expected outcome
expect(result.id).toBe('123');
expect(mockRepo.save).toHaveBeenCalledWith(user);

Test Naming: should [expected behavior] when [condition]

  • should return 404 when user not found
  • should hash password before saving to database
  • should reject email with invalid format

Coverage Requirements:

  • Unit tests: >85% code coverage
  • Integration tests: All adapter implementations
  • E2E tests: Critical user journeys

Test doubles co-location: Place mocks next to interface (e.g., storage_mock.go, taskAPI.mock.ts)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.