What is trunk-based development and how does it relate to testing?

Answer

Trunk-based development (TBD) is a source control branching strategy where developers integrate their work into the main branch (trunk) frequently — at least once per day, often multiple times. All developers commit to a single shared branch, with no long-lived feature branches. TBD's impact on testing: (1) Comprehensive test suite is mandatory: with everyone committing to main continuously, a fast, reliable test suite is the only safety net against breaking changes. (2) Feature flags: incomplete features are committed but hidden behind feature flags — tests can verify both enabled and disabled states. (3) Strict CI: every commit must pass all tests before merging — test failure blocks the pipeline. (4) Speed matters: a slow test suite (> 10 min) discourages frequent commits — optimize relentlessly. (5) Test quality: flaky tests are particularly harmful in TBD — any flakiness blocks everyone. TBD is the enabling practice for continuous deployment. It requires maturity in testing, feature flags, and CI/CD tooling.