Trunk-based development (TBD) is a branch management strategy in which all developers integrate their code frequently — at least once a day — directly into the main branch (trunk/main), with short-lived branches lasting 24 hours maximum, thus eliminating long-lived branches and complex merges.
Here's our position, and it's non-negotiable: you cannot practice trunk-based development without automated visual testing. It's like driving at 200 km/h without a seatbelt. Technically possible. Fundamentally irresponsible. For teams integrating visual checks into CI/CD, our guide on visual testing in CI/CD pipelines provides additional context.
Trunk-based development is a powerful practice. It accelerates delivery, reduces merge conflicts, and enforces continuous integration discipline. Teams that adopt it ship faster, with less merge pain, and with a smoother workflow.
But this power comes at a price: every commit lands on the main branch quickly. Every change is visible to the entire team within hours. And every regression — including visual regressions — propagates at the speed of your deployments.
In a GitFlow model with long-lived branches, you have days or weeks to detect a visual issue before it reaches main. In trunk-based, you have hours. Sometimes minutes. The traditional safety net — prolonged manual reviews, dedicated testing phases, visual validations by QA — no longer exists. You need to replace it with something as fast as your integration pace.
That something is automated visual testing.
Why Trunk-Based Amplifies Visual Risk
Trunk-based development isn't just another branching strategy. It's a radical philosophy built on a simple principle: the main branch is always deployable. Always. Every commit that lands on main must leave the system in a functional and correct state.
This principle is wonderful for velocity. It's formidable for visual regressions.
Commit Frequency Multiplies Risk Points
In trunk-based development, a team of five developers can easily produce 15 to 25 commits per day on main. Each of these commits is a visual risk point. A CSS change here, a dependency update there, a shared component refactoring further down.
In a long-branch model, these changes accumulate on feature branches and are reviewed collectively at merge time. The team can allocate time for a complete visual verification. In trunk-based, each change arrives individually and must be validated individually. The volume is the same, but the validation granularity is radically different.
And this is precisely where automated visual testing becomes indispensable. No human can visually verify 20 pages across 5 resolutions after every daily commit. Automation can.
Short Branches Limit Review Time
In trunk-based, branches live between a few hours and 24 hours maximum. This is a deliberate constraint that prevents long-branch drift. But this constraint also compresses the time available for review.
When a developer opens a merge request in the morning and it must be merged by end of day, code review time is limited. The review naturally focuses on business logic, code quality, and unit tests. Visual verification is the first to be skipped — it's perceived as less critical, more subjective, more time-consuming.
Except that visual regressions are neither subjective nor trivial when they reach production. Automated visual testing solves this problem by running in parallel with code review, without requiring additional time from the developer or the reviewer.
Side Effects Are Invisible in Diffs
The most treacherous aspect of visual regressions in trunk-based is that they're often caused by changes that don't directly touch the interface. A variable change in a theme file propagates effects to dozens of components. A CSS library update modifies default values. A shared component refactoring affects every page that uses it.
In the merge request diff, everything looks clean. The change is local, controlled, well unit-tested. But visually, it has ramifications invisible in the code. Visual testing is the only mechanism that captures these side effects because it doesn't look at code — it looks at the rendered result.
Visual Testing as a Main Branch Gate
In trunk-based development, the main branch is sacred. It must always be in a deployable state. To guarantee this state, teams set up gates — automated checks that must pass before a commit is accepted onto main.
These gates typically include unit tests, integration tests, static code analysis, and sometimes end-to-end tests. Visual testing must be one of these gates.
A Non-Blocking Test Is Useless in Trunk-Based
Some teams integrate visual testing as an "informational" check: the test runs, the result is displayed, but it doesn't block the merge. In trunk-based development, this is a mistake.
The speed of trunk-based means informational results get ignored. The developer wants to merge their short branch before end of day. They see unit tests pass. They see a visual warning. They merge anyway. "I'll look at it later."
In trunk-based, there is no "later." The next commit arrives within the hour. The visual regression is buried under ten new changes. It won't be discovered until production, when a user reports that the order form is unreadable on mobile.
Visual testing must block the merge if an unapproved regression is detected. That's the only way to guarantee the main branch stays visually intact.
The Three-Step Workflow
The visual testing workflow in trunk-based development is deliberately simple, because anything complex will be bypassed.
Step 1: the developer pushes to their short branch. The CI/CD pipeline triggers. Visual testing runs automatically and compares branch captures with main's references.
Step 2: results appear in the merge request. If no visual differences are detected, the test passes. The merge is authorized (subject to other gates). If differences are detected, the merge request is blocked until resolution.
Step 3: the developer handles the differences. If the visual change is intentional (new component, planned redesign), they update the reference. If it's a regression, they fix it. Either way, the decision is explicit and traceable.
This workflow takes no more than a few minutes per merge request. The visual report is visual (pun intended) — no need to read logs, just look at side-by-side images and decide.
Trunk-Based-Specific Risk Scenarios
Trunk-based development creates visual risk scenarios that don't exist (or are less frequent) in long-branch models.
The Silent Visual Conflict
Two developers work on two different features. Alice modifies the Header component to add a notification badge. Bob modifies the Footer component to add a legal link. Each change, taken individually, is visually correct.
But Alice's change slightly shifted the Header's z-index. And Bob's change added extra height to the Footer. Combined result on a small screen: the main content is crushed between an enlarged Header and Footer, and part of the text is invisible.
Code review doesn't detect this because each diff is clean. Unit tests don't detect it because each component works correctly in isolation. Visual testing detects it immediately because it captures the entire page as rendered.
The Invisible Dependency Update
You update a CSS library or component framework. The changelog mentions no visual changes ("breaking change: none"). Unit and integration tests pass. Everything seems normal.
But the new version changed default values for certain properties. Spacing is slightly different. A border-radius changed. A transition was added. Individually, these changes are minor. Collectively, they alter your application's appearance.
In trunk-based, this update lands on main quickly. If visual testing isn't in place, the subtle changes become the new normal. Nobody notices them until the day someone compares a screenshot from three months ago and wonders why the application looks different.
The Misconfigured Feature Flag
Feature flags are often used alongside trunk-based development to ship inactive code. A developer adds a new component behind a disabled feature flag. The code is on main, but the component isn't visible. All good.
Except if the component's CSS isn't properly isolated. Except if the hidden component's styles affect adjacent elements. Except if accidental flag activation in production produces a visual result nobody has ever seen because it was never visually tested.
Visual testing must cover the primary states of feature flags — at minimum, behavior with and without the flag enabled. That's the only way to guarantee that code shipped to main is visually correct in all planned states.
Optimal Configuration for Trunk-Based
For visual testing to be effective in trunk-based development, its configuration must reflect this strategy's constraints.
Execution Speed
In trunk-based, you can't wait 30 minutes for a visual test result. The pipeline must be fast to avoid becoming a bottleneck that pushes developers to bypass the gate.
The strategy is to test critical pages on every merge request (5-10 pages, 2-3 resolutions) and run a complete suite on main after the merge. The first gate is fast (a few minutes). The second is exhaustive but non-blocking for the developer.
Shared Reference Management
In trunk-based, visual references are tied to the main branch. When a developer updates a reference on their short branch, this update must merge cleanly onto main.
Best practice is to store visual references in a centralized system (not in the Git repository) and version them relative to main's state. This way, two developers who visually modify the same page don't conflict on references.
Adapted Tolerance Thresholds
Trunk-based development produces frequent, granular changes. Visual testing tolerance thresholds must be calibrated to avoid false positives without masking real regressions.
A threshold that's too strict (0% difference tolerated) will produce false positives on sub-pixel rendering differences between machines. A threshold that's too permissive (5% difference tolerated) will let real regressions through. A threshold of 0.1% to 0.5% is generally a good starting point, adjustable based on your context.
The Cost of Not Testing Visually in Trunk-Based
For skeptics who think visual testing is an optional luxury in trunk-based development, let's talk about the cost of its absence.
The cost of late detection. A visual regression detected in development costs five minutes to fix. Detected in staging, it costs an hour (context switching, investigation, fix, redeployment). Detected in production, it costs half a day minimum (alert, investigation, hotfix, communication, redeployment).
The cost of eroded trust. In trunk-based, the main branch is the source of truth. If it's visually unstable, developers lose confidence. They hesitate to merge. They delay their integrations. Trunk-based insidiously transforms into longer branches, and you lose the practice's benefits.
The cost of brand image. Every visual regression that reaches production is visible to your users. A misaligned button, truncated text, a page broken on mobile — these are signals of negligence. In B2B, where trust is the foundation of the business relationship, every visual bug costs credibility.
Where to Start
You practice trunk-based development (or you're considering adopting it) and you want to visually secure your main branch. Here's the action plan.
Day 1: identify your critical pages. List the 5 to 10 most viewed or most important pages for your business. Home page, product page, conversion funnel, dashboard — the pages your users see most and whose breakage has the most impact.
Day 2: set up a no-code visual testing tool. With Delta-QA, you create your visual references in a few clicks. No scripts, no complex configuration. You define the URLs, the resolutions, and the tool captures your references.
Day 3: integrate into your pipeline. Add visual testing as a gate in your CI/CD pipeline. Results appear in your merge requests. Unapproved regressions block the merge.
Week 1: calibrate thresholds. Observe the results. Adjust tolerance thresholds. Mask dynamic content. Refine the list of tested pages.
Week 2 and beyond: extend coverage. Gradually add secondary pages, additional resolutions, interface states (logged in/out, empty/full cart, etc.).
Trunk-based development is an elite practice. It demands discipline, tooling, and confidence in the pipeline. Automated visual testing is part of the essential tooling. Without it, your main branch is a highway without guardrails.
FAQ
Doesn't visual testing slow down the trunk-based development pace?
No, as long as it's well configured. Visual testing targeted at critical pages runs in 2 to 5 minutes, in parallel with your other pipeline tests. It's not visual testing that slows things down — it's undetected visual bugs that slow things down, when they require emergency hotfixes.
How do you manage reference updates when multiple developers modify the interface simultaneously?
This is one of the challenges specific to trunk-based. Best practice is to centralize visual references in a versioned system independent of the Git repository. When a developer updates a reference, it's immediately available for subsequent merge requests. Modern tools handle these updates atomically to avoid conflicts.
Does trunk-based development work without visual testing for small teams?
Small teams often feel they control the risk because "everyone knows the code." This is a false sense of security. Even in a two-developer team, visual regressions from side effects are common. Automated visual testing is relevant as soon as there's more than one commit per day on main — regardless of team size.
Should you visually test every commit or only merge requests?
In trunk-based, test visually on every merge request (blocking gate) and on main after each merge (post-integration verification). Testing on the merge request is the primary filter. Post-merge testing is the safety net that catches combination issues between commits.
How does visual testing interact with feature flags in trunk-based?
Visual testing must cover at minimum two states of each active feature flag: flag enabled and flag disabled. For flags with significant visual impact, add both states to your visual test suites. When a flag is removed (the feature is enabled for everyone), remove the "flag disabled" state from your tests and update references accordingly.
Can you practice trunk-based development with only end-to-end tests (without visual testing)?
Technically yes. But your end-to-end tests won't detect visual regressions — an invisible button that remains clickable in the DOM, text that overlaps an image, a component that overflows its container. End-to-end tests verify behavior. Visual testing verifies appearance. In trunk-based, where integration speed is maximal, you need both layers of protection.
Further reading
- Micro-Frontends and Visual Testing: The Only Safety Net for the Assembled Whole
- Visual Testing and Retina Images: If You Are Not Testing in HiDPI, You Are Not Seeing What Your Users See
- Visual Testing for Ruby on Rails: Why View Specs Are Not Enough and How Visual Testing Fills the Gap
Trunk-based development is a powerful accelerator. Visual testing is the braking system that allows you to use it safely. One doesn't go without the other.