본문으로 건너뛰기
cccskills
무료GitHub에 공개

behavior-driven-testing

Systematic testing methodology for exhaustive branch coverage, edge case identification, and production bug prevention. Use when PR review reveals incomplete test coverage, when tests pass but users report bugs, when code changes break existing features, when verifying all branches and edge cases before merge, when analyzing "it works on my machine" issues, when planning test strategy for new features, or when debugging flaky tests and race conditions.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(9)

  • SKILL.md5.2 KB
  • LICENSE1.0 KB
  • README.md558 B
  • references/analysis-phase.md5.3 KB
  • references/branch-matrices.md4.0 KB
  • references/design-phase.md2.8 KB
  • references/execution-phase.md3.5 KB
  • references/test-templates.md11.7 KB
  • references/testing-principles.md19.4 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Behavior-Driven Testing

Start from user behavior, not code structure. Every user-reachable path must be tested—no branch left uncovered, no edge case assumed.

Core Principles

  1. Behavior over Implementation - Test what users see, not how code works
  2. Exhaustive Coverage - Every branch, every condition, every edge case
  3. Context Awareness - Every test must define its preconditions explicitly
  4. Real Environment Validation - Mocks are tools, not destinations

Workflow Overview

Testing follows three phases. Follow them in order:

Analysis → Design → Execution → Verify Coverage → Ship (or loop back)

Analysis Phase:

  1. Requirements Definition - Define "correct" behavior with Gherkin specs
  2. Code Change Tracking - Know exactly what changed
  3. State Machine Analysis - Map all UI states and transitions
  4. Branch Mapping - Create the branch matrix (core artifact)

Design Phase: 5. Test Case Design - Apply equivalence partitioning, boundary analysis 6. Impact Analysis - Ensure new code doesn't break existing behavior 7. Test Prioritization - P0 (every commit) → P3 (periodic)

Execution Phase: 8. Test Data Preparation - Create fixtures, mocks, factories 9. Test Implementation - Write unit, integration, E2E tests 10. Test Execution - Run tests in phases (local → CI → staging) 11. Coverage Verification - Verify branch matrix completion

Quick Reference: Must-Test Branches

CategoryTest CasesPriority
Empty valuesnull, undefined, "", " " (whitespace), [], {}P0
Boundariesmin-1, min, min+1, max-1, max, max+1P1
Auth stateslogged in, logged out, loading, session expiredP0
API responses200+data, 200+empty, 400, 401, 403, 404, 500, timeout, offlineP0
User chaosdouble-click, rapid navigation, refresh mid-action, back buttonP1

The Whitespace Trap (Most Common Bug)

// ❌ WRONG - whitespace "   " is truthy!
if (!text) throw new Error('Required');

// ✅ CORRECT
if (!text?.trim()) throw new Error('Required');

Common Mistakes

MistakeWhy It's BadFix
Only happy pathError paths are 50% of codeTest ALL branches
Skip empty value testsMost common production bugsTest null, undefined, "", whitespace separately
Mock everythingMocks hide real problemsAdd integration + E2E tests
"Tested manually"Not repeatable, not reliableAutomate it
Ignore loading statesUsers interact during loadTest loading behavior
Skip double-click testUsers double-click everythingTest rapid interactions

Branch Matrix Template

For each code change, create a branch matrix:

| ID | Condition | True Behavior | False Behavior | Priority | Status |
|----|-----------|---------------|----------------|:--------:|:------:|
| B01 | user.isPremium | Skip credit check | Check credits | P0 | ⬜ |
| B02 | credits >= required | Proceed | Show error | P0 | ⬜ |
| B03 | credits == required | Boundary: Proceed | - | P1 | ⬜ |

Status: ⬜ Pending | ✅ Passed | ❌ Failed

Detailed References

Load these files only when you need detailed guidance:

Pre-Release Checklist

Before shipping, verify:

## Mock Tests (CI)
- [ ] All unit tests pass
- [ ] All integration tests pass
- [ ] Coverage thresholds met

## Real Tests (Before release)
- [ ] E2E tests pass on staging
- [ ] Manual smoke test on staging
- [ ] Core paths verified in real environment

## Branch Matrix
- [ ] All P0 branches tested
- [ ] All P1 branches tested
- [ ] No untested edge cases

## Production (After deploy)
- [ ] Smoke test passes
- [ ] Error rate monitoring normal

Related Skills

  • test-driven-development - Write tests first, then implementation
  • systematic-debugging - Debug issues methodically

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

이 스킬의 문제 신고