PABCD Initiative Documentation Hub pabcd_initiative codexclaw cli-jaw

Edge-First Testing Workflow

Source: dev-testing/references/edge-first-testing.md

Edge-First Testing Workflow

Principle

Write edge case tests BEFORE happy path tests. Most bugs hide at boundaries, not in the golden path. If you only have time for 5 tests, 4 should be edge cases.

Test Order by Change Type

Change TypeFirst TestsThen
New API endpointInvalid input, auth failure, rate limitHappy path
Data migrationEmpty table, max-size row, concurrent writeNormal migration
UI componentEmpty state, overflow text, disabled stateNormal render
Bug fixRegression test for the bugRelated edges
Config changeMissing value, malformed value, env mismatchDefault behavior
Async workflowTimeout, partial failure, retry exhaustionSuccessful completion

Edge Case Matrix (11 Classes)

ClassExamples Boundary0, 1, MAX, MAX+1, negative Emptynull, undefined, "", [], {}
Type coercion"1" vs 1, true vs "true", NaN
ConcurrencySimultaneous writes, read-during-write, lock contention
TimeoutNetwork timeout, DB timeout, queue timeout, graceful vs hard
PermissionNo auth, expired token, wrong role, revoked mid-session
EncodingUnicode, emoji, RTL text, special chars (&, <, "), zero-width
SizeExtremely long strings, huge payloads, many items, 0 items
StateUninitialized, mid-transition, corrupted, stale cache
OrderOut-of-order events, duplicate events, missing sequence
EnvironmentMissing env var, wrong timezone, disk full, DNS failure

Banned Patterns

PatternWhyFix
Testing only happy path firstBugs cluster at boundaries; happy-path-only gives false confidenceWrite edge tests first, happy path last
Mocking the thing you're testingProves nothing about real behaviorMock dependencies, not the subject
Tests that pass with any implementationZero signal; test is decorativeAssert specific outputs for specific inputs
Copy-paste test with one value changedHides missing edge classesUse the 11-class matrix above systematically
Asserting no error instead of correct resultPasses on silent wrong outputAssert the exact expected value

Definition of Done

  • Edge coverage >= happy path coverage (measure by test count per class)
  • Every class from the matrix above is represented OR explicitly marked N/A with reason
  • Regression test exists for every bug fix before the fix is applied
  • No test passes when the implementation is deleted or replaced with a stub