Skip to content

test: testing infrastructure overhaul — shared framework + dogfood scanner#397

Merged
Data-Wise merged 16 commits intodevfrom
feature/testing-overhaul
Feb 16, 2026
Merged

test: testing infrastructure overhaul — shared framework + dogfood scanner#397
Data-Wise merged 16 commits intodevfrom
feature/testing-overhaul

Conversation

@Data-Wise
Copy link
Owner

Summary

  • Added shared test-framework.zsh with 14 assertion helpers, mock registry (5 functions), and subshell isolation
  • Converted 45+ test files from inline pass/fail frameworks to shared framework
  • Added dogfood-test-quality.zsh scanner that catches 4 anti-pattern categories
  • Net reduction of 2,702 lines — less code, better coverage

Anti-pattern elimination

Category Before After
Permissive exit codes (0 || 1) 2 0
Existence-only tests 11 in 6 files 0
Unused output captures 21 in 8 files 0
Inline test frameworks 80 in 30 files 0

Key changes

  • tests/test-framework.zsh — assertion helpers, mock registry, subshell isolation
  • tests/dogfood-test-quality.zsh — meta-test scanner for anti-patterns
  • docs/specs/SPEC-testing-framework-2026-02-16.md — testing strategy spec
  • ORCHESTRATE-testing-overhaul.md — implementation plan

Test plan

  • Full test suite: 45/45 passing, 1 expected timeout
  • Dogfood scanner: 4/4 categories clean
  • Plugin loads cleanly (source flow.plugin.zsh exit 0)
  • No behavioral regressions — all pre-existing failures unchanged

🤖 Generated with Claude Code

Test User and others added 16 commits February 16, 2026 11:27
Option C from testing research — improve existing framework with
assertion helpers, mock registry, subshell isolation, and behavioral
test conversions across 3 parallel batches.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Enhance test-framework.zsh with mock registry (create_mock,
  assert_mock_called, assert_mock_args, reset_mocks), subshell
  isolation (run_isolated), and convenience aliases
- Convert test-work.zsh from existence-only checks to behavioral
  assertions (24 tests now verify exit codes, output, and mocks)
- Convert test-dispatcher-enhancements.zsh to use shared framework
  with assert_contains instead of inline grep checks
- Add dogfood-test-quality.zsh scanner that detects 4 anti-patterns:
  permissive exit codes, existence-only tests, unused output
  captures, and inline frameworks

Full suite: 45/45 passing, no regressions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace inline test frameworks with shared test-framework.zsh.
Convert existence-only checks to behavioral assertions, fix
permissive exit codes, and eliminate unused output captures.

Dogfood scanner delta: existence-only 94→65, unused captures 51→31,
permissive exit codes 14→11, inline frameworks 115→103.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three-layer testing taxonomy (unit/E2E/dogfood), framework comparison
(ShellSpec vs BATS vs ZTAP vs native), and anti-pattern catalog.
Complements ORCHESTRATE file with strategic direction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert 4 more test files to use test-framework.zsh with proper
behavioral assertions. Add test_skip() and TESTS_SKIPPED counter
to framework.

Anti-pattern progress: permissive 11→2, existence 65→45,
unused captures 31→21, inline frameworks 103→91.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert 4 high-anti-pattern test files to use test-framework.zsh:
- test-atlas-e2e.zsh: 19/19 passing (was inline framework + 11 existence-only)
- test-token-automation-unit.zsh: 25/25 passing (fixed jq newline capture)
- test-token-automation.zsh: 18/18+2skip+1skip (doc files skip in worktree)
- test-doctor-cache.zsh: 19/20 passing (fixed readonly scoping bug, 10→19)

Anti-pattern progress: existence 45→11, inline 91→80, permissive 2→1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- test-work.zsh: replace permissive exit code (0||1) with strict assert
- test-adhd.zsh: add output assertions to 6 help/flag tests
- test-capture.zsh: add output assertions to 6 unused captures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add output assertions to 3 timer tests that captured output
but only checked exit codes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ework.zsh

Eliminate inline pass/fail/log_test functions across 30 test files,
replacing them with shared test-framework.zsh assertions. This reduces
the dogfood scanner's inline framework violations from 80 in 30 files
to 2 in 1 file (97.5% reduction).

Files converted: test-ai-features, test-atlas-integration, test-cc-*,
test-course-planning-*, test-doctor-email-*, test-em-dispatcher,
test-flow, test-g-feature-*, test-keychain-default-automated,
test-mcp-dispatcher, test-obs-dispatcher, test-pick-*, test-production-*,
test-qu-dispatcher, test-quick-wins, test-r-dispatcher, test-status-fields,
test-sync, test-tm-dispatcher, test-token-automation-e2e, test-wt-*.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
All acceptance criteria met:
- 14 assertion helpers + 5 mock registry functions in test-framework.zsh
- 30+ test files converted from inline to shared framework
- Dogfood scanner: permissive exit codes eliminated (0), inline frameworks 80→2
- Full suite: 45/45 passing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert test-course-planning-docs-unit.zsh and
test-doctor-email-interactive.zsh from inline pass/fail/log_test
to shared test-framework.zsh. Reduces dogfood inline framework
violations to 0.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ptures)

- Add behavioral follow-ups to existence-only tests in 6 files
- Fix unused output captures in 4 files
- Dogfood scanner now passes 4/4 categories (all clean)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add `trap cleanup EXIT` to 31 test files that create temp dirs
  (prevents /tmp leaks when tests fail early)
- Standardize on `test_suite_end` instead of mixed `print_summary`
  (10 files updated for consistency)
- Update ORCHESTRATE results table to match final scanner output

Test suite: 45/45 passing, dogfood scanner: 4/4 clean

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Guard test_pass against double-counting when test_fail already fired
- Remove unused mock_function/restore_function (superseded by mock registry)
- Move ORCHESTRATE files from repo root to docs/specs/
- Add scalar-only limitation note to with_env helper
- Deduplicate .STATUS wins entries

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…framework

Resolves merge conflicts from work -e editor flag (PR #396) added on dev
after the testing overhaul branched. Converts 40+ new editor/help/arg-parser
tests from inline framework to shared test-framework.zsh assertions.

71/71 test-work.zsh passing, dogfood 4/4 clean, full suite 45/45.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Data-Wise Data-Wise merged commit 007a723 into dev Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant