testing-strategies
Skill0 starsChanged 4 months agoMITView on GitHub
Testing strategies including contract testing, snapshot testing, mutation testing, property-based testing, and test organization
8 other projects use a version of this.
Adopted by
Most recently taken up by
- theexperiencecompany/gaiatheir own version, first seen Nov 13, 2026
- ldaume/agentic-engineering-harnesstheir own version, first seen Oct 20, 2026
- mejbaurbahar/software-tester-skillstheir own version, first seen Oct 13, 2026
- Adhamxon/claude-code-skillstheir own version, first seen Jul 30, 2026
- fabioc-aloha/alex-cognitive-architecturetheir own version, first seen Apr 26, 2026
- terrene-foundation/pacttheir own version, first seen Apr 6, 2026
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- theexperiencecompany/gaia★ 327same name
- ldaume/agentic-engineering-harness★ 3same name
- Adhamxon/claude-code-skills★ 2same name
- harrissohail6/claude-code-config★ 1same name
- mejbaurbahar/software-tester-skills★ 1same name
- Typeless-Git/skills★ 1same name
- fabioc-aloha/alex-cognitive-architecture★ 0same name
- terrene-foundation/pact★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository4 other files it gives its agents.
- git-advancedSkill
- python-best-practicesSkill
- security-hardeningSkill
- tdd-masterySkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 71
Use inline snapshots for small outputs.
“Common” is measured: kept by at least 6 in 10 of the 6 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.
Files
Testing Strategies
Test Structure (Arrange-Act-Assert)
describe("OrderService", () => {
describe("createOrder", () => {
it("creates an order with valid items and returns order ID", async () => {
const repo = new InMemoryOrderRepository();
const service = new OrderService(repo);
const input = { customerId: "c1", items: [{ productId: "p1", quantity: 2 }] };
const result = await service.createOrder(input);
expect(result.id).toBeDefined();
expect(result.status).toBe("pending");
expect(result.items).toHaveLength(1);
const saved = await repo.findById(result.id);
expect(saved).toEqual(result);
});
it("rejects order with empty items", async () => {
const service = new OrderService(new InMemoryOrderRepository());
await expect(
service.createOrder({ customerId: "c1", items: [] })
).rejects.toThrow("Order must have at least one item");
});
});
});Name tests by behavior, not method name. Each test should be independent and self-contained.
Full runnable code for each technique below lives in
reference.md(sibling file).
Contract Testing (Pact)
Contract tests verify that consumer expectations match provider capabilities without requiring both services to be running. Use a Pact mock provider to record the consumer's expected request/response, then replay it against the real provider in CI. Full Pact example: see reference.md.
Snapshot Testing
import { render } from "@testing-library/react";
it("renders the user profile card", () => {
const { container } = render(
<UserCard user={{ name: "Alice", email: "alice@example.com", role: "admin" }} />
);
expect(container).toMatchSnapshot();
});
it("renders the order summary with inline snapshot", () => {
const summary = formatOrderSummary(mockOrder);
expect(summary).toMatchInlineSnapshot(`
"Order #123
Items: 3
Total: $45.99
Status: Pending"
`);
});Use inline snapshots for small outputs. Review snapshot diffs carefully during code review.
Property-Based Testing
import fc from "fast-check";
describe("sortUsers", () => {
it("always returns the same number of elements", () => {
fc.assert(
fc.property(
fc.array(fc.record({ name: fc.string(), age: fc.nat(120) })),
(users) => {
const sorted = sortUsers(users, "name");
return sorted.length === users.length;
}
)
);
});
});Assert algorithmic invariants (length preserved, output sorted, idempotence) rather than specific outputs. A second invariant — "output is actually sorted for any input" — is in reference.md.
Integration Test with Test Containers
Spin up real dependencies in containers (e.g. PostgreSqlContainer("postgres:16")) so integration tests exercise the genuine data layer instead of mocks. Start the container in beforeAll, migrate, run assertions against the real DB, and stop it in afterAll (allow a generous timeout, e.g. 60s, for container startup). Full Postgres example: see reference.md.
Test Doubles
function createMockEmailService(): EmailService {
const sent: Array<{ to: string; subject: string }> = [];
return {
send: async (to, subject, body) => { sent.push({ to, subject }); },
getSent: () => sent,
};
}
const emailService = createMockEmailService();
const service = new NotificationService(emailService);
await service.notifyUser("user-1", "Welcome");
expect(emailService.getSent()).toHaveLength(1);
expect(emailService.getSent()[0].subject).toBe("Welcome");Anti-Patterns
- Testing implementation details instead of behavior
- Sharing mutable state between tests (no
beforeEachreset) - Writing tests that depend on execution order
- Mocking everything instead of using real dependencies for integration tests
- Ignoring flaky tests instead of fixing the root cause
- Testing trivial getters/setters while missing edge cases
Checklist
- Tests organized by behavior, not by method or file
- Each test follows Arrange-Act-Assert structure
- Contract tests verify inter-service API compatibility
- Snapshot tests reviewed during code review (not blindly updated)
- Property-based tests cover invariants for algorithmic code
- Integration tests use test containers for real dependencies
- Test doubles are minimal and behavior-focused
- CI fails on flaky test detection
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
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.

