testing

Solid

This skill should be used when the user asks to "write tests", "fix failing tests", "improve test coverage", "add integration tests", "debug a flaky test", or reviews test quality. Provides behavior-focused testing patterns, coverage analysis, and detection of brittle test anti-patterns like implementation coupling and non-deterministic assertions.

Testing & QA 17 stars 1 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 79/100

Stars 20%
42
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Testing Patterns ## Iron Law > **TESTS VALIDATE BEHAVIOR, NOT IMPLEMENTATION** [4][8] > > A test should fail when behavior breaks, not when implementation changes. Mock at > boundaries, not internals. Test the contract, not the code path. If tests are hard to > write, the design is wrong — fix the architecture, not the tests. [3][8] --- ## Testing Shapes [6][7][10] | Shape | Guidance | |-------|---------| | Pyramid [6] | Many unit → fewer integration → fewest E2E | | Trophy [7] | Integration tests give best ROI for UI-heavy code | | Google [4] | 70% unit / 20% integration / 10% E2E; avoid E2E excess [12] | --- ## Test Doubles Taxonomy [1][9] | Type | When to Use | Example | |------|------------|---------| | **Dummy** | Fill unused parameters | `null`, empty object | | **Stub** | Return canned data, no assertions | `getRate: () => 0.1` | | **Spy** | Record calls, assert after | `jest.spyOn()` on public methods | | **Mock** | Pre-programmed expectations | `expect(fn).toHaveBeenCalledWith(x)` | | **Fake** | Working substitute (in-memory DB) | `InMemoryUserRepo` | "Mock roles, not objects" — mock interfaces you own, never third-party internals [3][9]. --- ## Test Design Red Flags | Red Flag | Symptom | Root Cause | Fix | |----------|---------|-----------|-----| | Complex setup >10 lines [8] | `beforeEach` with 6+ mocks | Too many dependencies | Split service; use fakes [1][4] | | Repetitive try/catch [8] | Same pattern >3 times | API throws, not Result | Migrate to ...

Details

Author
dean0x
Repository
dean0x/devflow
Created
10 months ago
Last Updated
yesterday
Language
TypeScript
License
MIT

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category