The BugBash Podcast

Escaping the Spaghetti: How to Test Untestable Codebases

Mar 4, 2026
Lewis Campbell, consultant at OutData who specializes in testing and reliability for legacy SaaS, explains practical ways to tame messy code. He covers adding static typing and schemas, extracting deterministic islands from tangled apps, moving business logic out of React, and using property-based and simulation-style randomized tests to reveal bugs. He also talks about political tactics for surgical refactors and team buy-in.
Ask episode
AI Snips
Chapters
Transcript
Episode notes
INSIGHT

Grow Islands Of Determinism Not Big Rewrites

  • Aim for small islands of determinism inside a legacy system rather than a single deterministic core rewrite.
  • Those islands can grow and join over time and give practical, testable reasoning without rewriting everything.
ADVICE

Extract Business Logic From React Components

  • Pull business logic out of React components and into plain JS/TS modules to make it testable and deterministic.
  • Keep components dumb; move repeated logic into testable functions so you can unit-test islands of determinism first.
ADVICE

Build Testing Up From Simple Unit Checks

  • Start small with unit/example tests as sanity checks, then generalize into property-based tests and deterministic simulation testing.
  • Don’t let perfection block progress: parameterize tests incrementally to expose more cases without an all-or-nothing rewrite.
Get the Snipd Podcast app to discover more snips from this episode
Get the app