do-behavioral-testing

Write behavior-focused tests that assert user-observable outcomes instead of implementation details.

2|Updated May 25, 2026
One-click install
npx skills add https://github.com/edheltzel/Do-Skills --skill do-behavioral-testing-edheltzel
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: do-behavioral-testing
Source: https://github.com/edheltzel/Do-Skills/tree/main/skills/core/do-behavioral-testing
Command: npx skills add https://github.com/edheltzel/Do-Skills --skill do-behavioral-testing-edheltzel

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Tests often become brittle, verbose, and coupled to implementation details, breaking on every refactor even when user-facing behavior is unchanged. This Skill provides a behavioral testing methodology that keeps tests terse, meaningful, and resilient to refactoring. ## Core Features & Use Cases - Behavior-First Test Design: Enforces the Arrange-Act-Assert pattern with assertions only on user-observable outcomes, plus naming conventions that describe behavior rather than functions. - Anti-Pattern Detection: Provides gate checks for common mistakes like testing mock behavior, over-mocking, incomplete mocks, and test-only production methods. - Systematic Branch Coverage: Includes a branch matrix methodology with P0-P3 prioritization to cover error paths, empty inputs, and user chaos scenarios without combinatorial explosion. - Use Case: When reviewing a test suite where mock setup exceeds the actual test logic, apply the stop checks to identify implementation-coupled assertions and rewrite them as terse integration tests using real components. ## Quick Start Ask the AI to review your existing test file using the behavioral testing methodology and rewrite any tests that assert on mocks or implementation details.

Frequently Asked Questions about do-behavioral-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write tests that don't break when I refactor?▼

Assert only on user-observable outcomes like rendered text, state transitions, and error messages rather than internal function calls or mock interactions. If a refactor breaks a test while behavior stays the same, the test was coupled to implementation and should be rewritten.

When should I use mocks in unit tests?▼

Mock only external boundaries such as network calls, third-party services, and timers that are outside your control. Never mock internal modules or components you own; if mock setup exceeds half the test code, switch to an integration test with real components.

What is the difference between behavior testing and implementation testing?▼

Behavior testing asserts what the user sees, such as "shows error when email is empty", while implementation testing asserts how code works, like which functions were called with what arguments. The former survives refactors; the latter breaks on any internal change.

How do I achieve good test coverage without testing every combination?▼

Use a branch matrix that maps conditions affecting behavior and assign priorities: test all P0 branches independently, test important P1 combinations, and skip logically impossible combos. Four conditions produce 16 combinations but typically only about 8 tests are needed.

Does this testing approach work with pytest and Python?▼

Yes, the references include Python equivalents using pytest parametrize for edge case tables, fixtures as test data factories, and respx for mocking HTTP boundaries. The same behavior-first principles apply across JavaScript, TypeScript, and Python.

Why do my tests pass but bugs still reach production?▼

Tests likely cover only happy paths, which represent roughly 30 percent of code behavior, while error handling and edge cases hold most bugs. Test empty, null, and whitespace inputs separately, cover API failure recovery, and include user chaos scenarios like double-clicks and mid-action refreshes.