Intent-Based Testing
Intent-based testing is a test authoring style where each step describes what the user is trying to do (intent) rather than how to perform it (selectors and actions). Tests survive UI changes because the system re-resolves the correct element from intent at runtime.
In one sentence
Intent-based testing replaces brittle locator-and-action scripts with steps that describe user goals — intent: Click the Save button — and lets a runtime layer figure out which element matches that goal each time the test runs.
Why it exists
Traditional E2E tests fail when UI elements change: a renamed CSS class, a restructured DOM, or an A/B-tested layout breaks the test even though the user-visible behavior is unchanged. Roughly 40–60% of QA effort in script-based suites goes to repairing these false breaks. Intent-based testing eliminates that category of failure by separating what should happen from how it currently happens to be implemented.
Three layers of an intent-based test
| Layer | Purpose | Example |
|---|---|---|
| Goal | The outcome the test verifies | "Verify user completes onboarding" |
| Intent | A step described as user intent | "Fill in name, email, and password" |
| Resolution | Runtime mapping from intent to element | DOM/AI inspects current page, picks the matching field |
Common authoring formats
- YAML in git — tests live alongside code, reviewable in PRs (Shiplight YAML format)
- Plain English in a dashboard — testRigor, Mabl
- Generated by an AI coding agent — agent calls an agent-native QA tool that emits an intent-based test
How it differs from "AI-augmented" testing
AI-augmented tools layer AI on top of selector-based tests — smart locators that sometimes recover from minor changes. Intent-based testing replaces selectors with intent at the source. The test never had a brittle selector to break.
Common pitfall
Intent-based authoring makes tests more readable but the underlying resolution layer must be solid. If resolution is unreliable, tests become non-deterministic. Pair intent-based authoring with cached deterministic resolution (the intent-cache-heal pattern): use the cache for speed, fall back to AI resolution only when the cache is invalidated by real UI change.