Generating Autotests and Locators with AI on a Legacy Project: Hands-On Experience

In her previous article, the author found that without a README describing the test framework's architecture, generating autotests on a large legacy project turns into an endless cycle of reviews and fixes. In the new article, she walks through exactly how she generated the autotests and locators, how much time it took, where the model still made mistakes, and whether the effort was worth it.

AI-processed from Habr AI; edited by Hamidun News
Generating Autotests and Locators with AI on a Legacy Project: Hands-On Experience
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Key metric #1Format — the second article in a series on generating autotests and locators with AI
Key metric #2Prerequisite from the first article — a README describing the framework architecture is mandatory for a legacy project
Key metric #3Focus of the new article — the concrete process, time spent, and the model's typical mistakes

The author continues her hands-on series on test autogeneration. In the new article, she walks through exactly how she generated autotests and locators for a large legacy project, how much time it took, where the model made mistakes, and whether it was worth it.

What the previous part of the series showed

The author's previous article had already established the key takeaway: without a README describing the test framework's architecture, generating autotests on a large legacy project turns into an endless cycle of reviews and fixes. Without context on how the framework works — which base classes to use, how locators are organized, which conventions the project follows — the model keeps proposing code that has to be rewritten by hand instead of producing a working result right away.

That takeaway frames the new piece: once the basic prerequisite — an architecture description — is in place, the question becomes one of practice. This is where the author starts the new article, promising to show not abstract advice but a concrete process for generating autotests and locators on real code.

Where locator generation usually stumbles

Locators are arguably the weakest point of UI test autogeneration. They depend on a page's specific markup, which in legacy projects is often unstable, inconsistent, and undocumented. A model that generates locators without a deep understanding of a given screen's actual DOM structure risks proposing brittle selectors — ones that break at the slightest layout change, or that duplicate locators already in the project instead of reusing them.

That's why the author focuses the new article on three practical questions: how much time this approach actually saves compared with writing tests by hand, in which scenarios the model keeps making mistakes even with an architecture README, and whether it pays off at the scale of a large legacy project, where the cost of test errors is false CI failures and team time lost to triage.

  • Format — the second article in a series on generating autotests and locators with AI
  • Prerequisite from the first article — a README describing the framework architecture is mandatory for a legacy project
  • Focus of the new article — the concrete process, time spent, and the model's typical mistakes
  • System under test — a large legacy project

What it means

The experience from series like this one shows that, in practice, AI-generated autotests don't boil down to a simple "ask and get working code." They require upfront work on project context and a sober assessment of where the time savings are real and where they're offset by manual review and rework of the generated code.

Key Questions Answered

What the previous part of the series showed?

The author's previous article had already established the key takeaway: without a README describing the test framework's architecture, generating autotests on a large legacy project turns into an endless cycle of reviews and fixes. Without context on how the framework works — which base classes to use, how locators are organized, which conventions the project follows — the model keeps proposing code that has to be rewritten by hand instead of producing a working result right away. That takeaway frames the new piece: once the basic prerequisite — an architecture description

Where locator generation usually stumbles?

Locators are arguably the weakest point of UI test autogeneration. They depend on a page's specific markup, which in legacy projects is often unstable, inconsistent, and undocumented. A model that generates locators without a deep understanding of a given screen's actual DOM structure risks proposing brittle selectors — ones that break at the slightest layout change, or that duplicate locators already in the project instead of reusing them. That's why the author focuses the new article on three practical questions: how much time this approach actually saves compared with wr

What it means?

The experience from series like this one shows that, in practice, AI-generated autotests don't boil down to a simple "ask and get working code." They require upfront work on project context and a sober assessment of where the time savings are real and where they're offset by manual review and rework of the generated code.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Private AI Builders Community · Vibe Club

Ship AI Faster with Founders, Engineers & Weekly Architecture Reviews

Inside Vibe Club (hamidun.com/club) — weekly live masterminds with Zhemal Khamidun, Tech Radar, full LMS access, and 370+ production Claude Code skills.

Join Vibe Club →Explore Hamidun Academy
What do you think?
Loading comments…