AI Testing Strategy 10 cited sources

The Test Pyramid Isn’t Inverting.
It’s Widening.

Why I’m joining Karate Labs, and why AI is densifying the top of the pyramid instead of flipping it.

PJM
Pier-Jean Malandrino (LinkedIn profile)

UI Product Strategy & AI Advisor, Karate Labs

· 11 min read

The argument in three points

01

E2E tests were never rare because they were hard to write. They were rare because they are slow and expensive to execute. AI barely moves that.

02

What AI does move is the value side: more code shipped, structurally worse on average, so more behaviour needs validating where it matters.

03

Unit tests written by the same AI that wrote the code approach a tautology. A behaviour-anchored test sits outside that loop.

Some news first: I’m joining the Karate Labs team as UI Product Strategy & AI Advisor.

For those who don’t know it, Karate is one of the open-source test automation frameworks I respect most: API and UI testing in a single tool, executable Gherkin, clean design, and a large, mature community built over years by its creator, Peter Thomas.

This didn’t start with a job offer. It started in 2023, when I published a hands-on comparison of Selenium and Karate, a concrete one, code and CI/CD included, because the theoretical comparisons were already legion. The Karate team read it; Peter shared it; conversations with Peter and co-founder Kapil Bakshi followed, and we ended up running a webinar together. The exchange never really stopped. Three years later, it turns into a role.

The fair question remains: why would a CTO who spends his days on production AI systems invest part of his time in a testing framework, now?

The short answer: because I believe end-to-end testing is quietly changing economic status, and I want to be where that shift is actually being built, not just commented on.

The long answer is this article. And because extraordinary claims deserve evidence, I’ll back each step of the argument with recent research rather than vibes.

Full disclosure, before anything else

I’m now part of the team. That means I’m no longer a neutral observer when I write about Karate, Karate Agent, or AI in testing. I’d rather say it myself, plainly, than have someone point it out in the comments.

What doesn’t change: I’ll keep writing the way I always have. Measured claims, numbers when I have them, and explicit limits. If anything, being on the inside raises the bar. An insider who overhypes is worse than a marketer who does.

The thesis: the pyramid widens, it doesn’t invert

You’ve probably seen the takes claiming AI “inverts the test pyramid”: fewer unit tests, everything end-to-end. I think that’s wrong, and conveniently wrong for people selling E2E tooling. In fairness, that group now includes my own team, and the more moderate thesis I’m about to defend serves them too. Which is exactly why every step below leans on independent research: judge the evidence, not the messenger.

The test pyramid widening rather than inverting Two diagrams side by side. On the left, the classic test pyramid with a narrow end-to-end tip, a medium integration layer, and a wide unit test base. On the right, the same pyramid with every layer wider and the end-to-end layer widened most, forming a broad band at the top rather than a point. CLASSIC Unit Integration E2E AI WIDENED Unit Integration E2E Top starved by execution cost Every layer grows, the top most The shape holds. The volume changes.

Swipe the diagram to see both states →

AI lowers the cost of authoring and maintaining tests at every layer. Because the top was the most cost-constrained, it gains the most, without the base losing its reason to exist.

The pyramid, from Mike Cohn’s original formulation to the canonical write-up on martinfowler.com, was never narrow at the top because E2E tests were hard to write. It was narrow because they are slow to execute, expensive in CI infrastructure, and coarse in their feedback. And here I have to be precise, because I don’t buy the lazy version of my own argument. AI is starting to move some of these constraints, and I say that as someone now helping build agents designed to do exactly that. Feedback is becoming less coarse on two fronts, and I can say both are workstreams we take seriously at Karate. A model can localize what diverged and why, instead of leaving you with a red cross and a stack trace. And self-healing absorbs the noise of UI drift, the broken locators and cosmetic changes, so the failures that survive are far more likely to be real behavioral divergences. When the red you see actually means something, the feedback stops being coarse. Suite-level economics shift too, when models help select which scenarios to run and triage flakiness. But the hard core remains: a real browser journey against a real system takes the time it takes, CI still bills by the browser-minute, and putting a model in the runtime adds an inference cost line that didn’t exist before. Some criteria move; not enough to invert the pyramid. Unit tests still give you fast, isolated feedback that nothing else provides.

The cost of executing an E2E test barely moves, but the value of having it explodes.

AI changes the ROI equation, from both ends at once.

Numerator AI-assisted development means dramatically more code shipped, and the data here is unambiguous. GitClear’s longitudinal research, with 211 million changed lines analyzed for the 2025 report and 623 million changes through 2026, documents record code output alongside deteriorating structural signals: block duplication up 81% versus 2023, refactoring moves down 70%, and 2024 as the first year on record where copy/paste exceeded refactored code. More code shipped, and code that is structurally worse on average, means more behavior that needs validating at the level where it actually matters: the user’s journey through the system.

+81%
Block duplication vs 2023
−70%
Refactoring moves
834M
Changed lines & changes analysed across both GitClear reports
~5,000
Professionals surveyed in DORA 2025

Google’s DORA 2025 report, based on nearly 5,000 technology professionals, completes the picture: AI adoption now correlates positively with delivery throughput and negatively with delivery stability. Their own framing: “AI accelerates software development, but that acceleration can expose weaknesses downstream.” The control systems DORA names as the remedy? Strong automated testing and fast feedback loops. I couldn’t ask for a better summary of why the top of the pyramid matters more now, not less.

Denominator Writing and maintaining E2E tests was always the painful part: brittle selectors, endless glue code, suites that rot faster than they’re written. This is precisely where LLM-based approaches are advancing fastest. A 2026 peer-reviewed synthesis of 55 studies (January 2023 to July 2025) on LLMs in GUI testing documents the shift from rigid script generation toward intent-driven exploration and self-healing maintenance. It also notes that effective agents have converged on combining visual screenshots with DOM structure to ground intent into precise actions. That convergence, incidentally, is exactly the architectural bet behind approaches like Karate Agent.

And the two levers compound. AI-assisted authoring turns readable intent into executable scenarios; agentic self-healing keeps them alive as the UI evolves. A suite that is continuously repaired instead of slowly rotting stays trustworthy, and a trustworthy suite is one teams actually run and act on. Reliability is not a nice-to-have here; it is a third multiplier on the ROI, after authoring cost and maintenance cost.

More value to validate, at a fraction of the historical cost. E2E scenarios that were prohibitively expensive to justify become trivial to justify. The top of the pyramid, historically starved, densifies. So do the other layers: AI makes unit and integration tests cheaper too. The whole pyramid grows. But the relative change is largest at the top, because that’s where the cost was most prohibitive.

The objection you should raise

If you’ve been reading carefully, you should now object: “You just cited evidence that AI degrades application code. Why on earth would AI-written tests be any better?”

Fair. Two answers.

Answer one

A closed vocabulary can’t sprawl

There is essentially one way to express “click this, expect that.” You cannot accumulate clever glue code in a language designed to have none.

Answer two

AI proposes, humans dispose

Generated scenarios arrive as readable diffs a person approves, because the DSL keeps them readable by people who aren’t automation engineers.

First, an application codebase and an E2E test codebase are not the same object. The GitClear degradation signals (duplication sprawl, dying refactoring) emerge in general-purpose code, where there are a thousand ways to express the same thing and unbounded room for structural drift. A deliberately small, high-level DSL like Karate’s changes that geometry: there is essentially one way to express “click this, expect that,” the vocabulary is closed, and the output is short, declarative, and readable line by line. You cannot accumulate clever glue code in a language designed to have none. Constraining the generation space is not a side effect here; it’s the point.

Second, review stays structural, not optional. The autonomous test-repair case study I cite below shows what happens without it. The sane pattern, and the one I’ll defend, is AI proposing, humans disposing: generated scenarios and healed locators arrive as readable diffs that a person approves, precisely because the DSL keeps them readable by people who aren’t automation engineers.

The tautology problem

There’s a second argument for the top of the pyramid, and I think it’s the stronger one.

When a human writes the code, unit tests verify “I built what I intended to build.” That’s meaningful: human intent and human implementation genuinely diverge.

When an AI writes both the code and its unit tests, those tests largely verify “the AI understood what the AI meant.” That’s close to a tautology. And the research increasingly backs the intuition. An empirical study presented at ASE 2024 (Yang et al.) evaluated LLM-generated unit tests against Defects4J and found their defect detection ability weak: for the large majority of defects, no valid test was generated at all, and even among detectable defects, roughly half went undetected. A systematic review of 115 publications (2021 to 2025) reaches the same conclusion: weak fault detection remains the open challenge of LLM-based test generation. And a 2026 mutation-driven study from Virginia Tech and CMU asks the uncomfortable question directly: do LLM-generated tests reflect genuine reasoning about program behavior, or do they reproduce superficial patterns from training?

Let me be honest about what these findings imply, because they cut both ways: a naively AI-generated E2E test inherits the same weakness. Generation alone guarantees nothing. What breaks the tautology is not the generator; it’s the anchor. A test anchored on user-facing behavior, written in a language the business can read and validate, sits outside the AI’s self-referential loop in a way that a generated unit test never can. The oracle is a human who knows what the product should do, not the model that wrote the code.

Which is why I believe executable BDD, meaning Gherkin scenarios that actually run against the real system, is becoming the standard for the top of the pyramid in an AI-assisted world. BDD’s original sin was always the gap between the scenario written by the three amigos and its automation, which fell back on developers and QA as thankless glue work. AI is closing precisely that gap. Some in the testing community have started calling the LLM the “fourth amigo.” I think the framing holds.

And it reshapes the team, not just the tooling. For twenty years we’ve split QA into two castes: manual testers who know the business but don’t automate, and automation engineers who automate but drift from the business. If generation becomes cheap and the scenarios stay readable, that wall stops making sense. The manual profile moves to where its knowledge was always most valuable: expressing and validating business intent, driving generation. The automation profile moves to guaranteeing the quality behind it: reviewing what was generated, hardening the technical layer, owning the pipeline. Not two castes; one team, reunified around the tool. That reunification is, to me, the most underrated consequence of this whole shift.

Why Karate, specifically

Follow the thesis to its conclusion. If the top of the pyramid densifies, and executable BDD becomes its standard, then the frameworks that matter are the ones positioned exactly there: open source, Gherkin-native, covering API and UI in one coherent model, with a real community rather than a demo video.

That’s not a description I reverse-engineered to flatter my new team. It’s the market reading that led me to write that comparison in 2023, long before any role existed. Karate’s API testing foundation is solid and widely adopted. The frontier now is UI, and the honest, hard question of where AI fits into it (a question that goes well beyond the Selenium-versus-Karate comparison I started with). That’s the work I’m joining for.

What I’ll actually be doing

My focus is UI product direction, and one architectural question in particular: where should the LLM sit in the lifecycle of a UI test?

There are at least three schools of thought emerging in the industry.

Lowest autonomy

Authoring-only

AI generates tests but stays out of the runtime.

Middle ground

Embedded safety net

The runtime can recover when the UI drifts.

Highest autonomy

Full runtime pilot

An agent drives the browser end to end.

Each has real trade-offs in determinism, cost, and trust, and the industry has not settled the question. A recent industrial case study of a fully autonomous multi-agent test repair system is instructive here: under high autonomy in a realistic enterprise UI environment, the system exhibited severe failure modes, including a phase where planning appeared healthy while test generation had silently collapsed. Autonomy is not free. Working through exactly those trade-offs, with a framework that has actual production users, is the kind of problem I enjoy.

I’ll share what we learn as it ships. Measured, and with numbers when I can.

The limits

What AI doesn’t solve

Because this is the section that makes everything above credible.

Anyone who tells you the pyramid is dead because AI writes tests now is skipping both the physics and the evidence.

The pyramid’s shape was always dictated by execution constraints, and those remain. What changes is how much you can afford to build at each layer. That’s a big deal. It’s just not the same deal as the hype version.

What comes next

I’ll keep doing what I do: building, measuring, and writing about what actually works, now with a seat inside one of the frameworks where this shift is being built. If you’re working on AI in testing, whether you agree with the thesis above or think I’m wrong about the pyramid, I’d genuinely like to hear it.

References

10 sources
  1. Malandrino, P.-J. Selenium versus Karate: a concrete comparative approach. Scub-Lab, 2023. lab.scub.net
  2. Vocke, H. The Practical Test Pyramid. martinfowler.com, 2018. martinfowler.com
  3. GitClear. AI Copilot Code Quality: 2025 Research (211M changed lines, 2020 to 2024). gitclear.com
  4. GitClear. The Maintainability Gap: 2026 AI Code Quality Research (623M changes, 2023 to 2026). gitclear.com
  5. Google Cloud / DORA. 2025 State of AI-assisted Software Development. dora.dev
  6. Yang, L. et al. On the Evaluation of Large Language Models in Unit Test Generation. ASE 2024. arxiv.org/abs/2406.18181
  7. Large Language Models for Unit Test Generation: Achievements, Challenges, and the Road Ahead. Systematic literature review of 115 publications (2021 to 2025). arxiv.org/abs/2511.21382
  8. Haroon, S., Khan, M.T., Gulzar, M.A. Evaluating LLM-Based Test Generation Under Software Evolution. 2026. arxiv.org/abs/2603.23443
  9. A process-centric review of large language models in GUI testing. PeerJ Computer Science, 2026 (55 studies, 2023 to 2025). peerj.com
  10. Practical Limits of Autonomous Test Repair: A Multi-Agent Case Study. 2026. arxiv.org/abs/2605.01471

About the author

PJM
Pier-Jean Malandrino (LinkedIn profile)

CTO at SCUB and AI Ambassador for the French Ministry of Economy (“Osez l’IA”). He designs production AI systems, contributes to open-source tooling, and writes about the intersection of architecture and AI-assisted development. He recently joined Karate Labs as UI Product Strategy & AI Advisor.

Executable BDD at the top of the pyramid

Karate Agent brings AI-assisted authoring and self-healing to UI tests. Self-hosted, bring your own LLM, Docker-native.