AI Testing: Are You Testing AI or Using AI for Testing?
This article clarifies two distinct meanings of "AI testing"—testing an AI system versus using AI to perform testing—and explains why most beginners work in the second category. It outlines four common pitfalls, a three-part standard for deciding what to automate, and five repeatable testing tasks suitable for AI, including end-to-end test generation with self-healing locators, unit test completion, mock data construction, visual regression, and defect localization. It closes with a practical adoption path from ad-hoc trials to a fixed workflow, plus a capability map for newcomers.
1. First, Clear Up the Concept: Two Kinds of “AI Testing” Are Not the Same
Many teams use the term “AI testing” interchangeably in job descriptions and internal reports, but it covers at least two completely different directions.
The first is when the object under test is AI—verifying whether an intelligent system meets expectations. The focus is on the correctness, stability, robustness, fairness, hallucination rate, refusal behavior, and inference latency and cost of model outputs. The second is using AI to do testing—embedding intelligent capabilities into the development workflow so they take over repetitive work such as test case design, script generation, data construction, defect localization, and coverage improvement, while the object under test remains a conventional business system.
For people new to the field, the vast majority of day-to-day scenarios fall into the second category. Conflating the two leads directly to mismatched expectations: you assume you are working with a “thinking colleague,” but what you actually get is a probabilistic text generator, which produces the impression that it works “sometimes well, sometimes badly.”
2. Four Pitfalls Beginners Fall Into Most Easily
- Dumping an entire requirements document into the model and asking it to “invent test cases.” Without decomposition, constraints, and acceptance criteria, the output is inevitably a generic feature checklist that cannot go straight into execution.
- Regression cases all break at once when the UI changes. Scripts based on fixed selectors are extremely sensitive to page structure; a single style refactor can make dozens of cases fail simultaneously.
- Mock data is built manually every time. Boundary values, exception states, and permission combinations are assembled by hand—repetitive and easy to miss.
- Coverage stays low and nobody bothers to fill the gap. The marginal return on adding tests is low and the psychological barrier is high, so the debt persists.
The common root cause of these problems is not insufficient model capability but a missing fixed workflow: trials are scattered and one-off, with no input specification, no output validation, no fallback on failure, and no integration with the existing pipeline. No matter how strong the tool is, it only creates the illusion of “looking busy” inside a chat window.
3. The Criteria: Which Steps Are Worth Handing to AI
Whether a step is worth automating can be measured with three questions: is the input structured, can the output be validated automatically, and is the cost of failure controllable? The payoff is highest when all three are satisfied.
Take test case generation as an example. The input is the requirements document and API definitions, the output is executable scripts, validation is done through run results and assertion pass rates, and the cost of failure is merely one red pipeline—it fully meets the conditions. In contrast, deciding whether a given phenomenon is a real defect involves vague input, subjective validation, and a high cost of failure, so the model should not make the final call.
4. Five Categories of Repetitive Work That Can Be Automated, by Scenario
4.1 End-to-End Test Generation and Self-Healing Locators
The traditional approach relies on record-and-replay plus fixed selectors. A more mature general approach is to have the engine collect an element’s text features, visual features, and page context at the same time, then re-match by weight when the structure changes to achieve self-healing locators.
The following pseudocode illustrates this matching logic:
candidates = dom.query_similar(target.text, target.role)for c in candidates:score = 0.5 * text_similarity(c, target) \+ 0.3 * visual_similarity(c.screenshot, target.screenshot) \+ 0.2 * context_similarity(c.ancestors, target.ancestors)if score > THRESHOLD:return craise LocatorNotFound(target)
The boundary must be emphasized: slight shifts and minor copy tweaks can usually be repaired automatically, while a large-scale information architecture redesign still requires manual review. Self-healing reduces maintenance cost; it cannot replace your judgment on “whether this is a real bug.”
4.2 Unit Test Completion and Code Understanding
The coverage number itself has no value; what has value is whether the assertions verify business semantics. A workable process is to trigger an AI coding tool on the changeset, let it read the code context, generate candidate tests for boundary conditions, exception branches, nulls, and out-of-range values, and then have the developer review each assertion.
// Candidate test example: a human must confirm the assertion matches business expectations@Testvoid shouldRejectNegativeAmount() {assertThrows(IllegalArgumentException.class,() -> account.withdraw(-1));}
There are three review priorities: whether the assertion targets a business rule rather than an implementation detail; whether there are empty tests that “execute but verify nothing”; and whether the rising test count actually improves defect detection capability.
4.3 Mock Data Construction
Change data generation from manual work to rule-driven work: derive value domains from API definitions and field constraints, then produce datasets in bulk using equivalence partitioning and boundary value analysis, including extremely long strings, timezone boundaries, concurrency conflicts, and permission combinations. This kind of work is especially valuable in stateful services, where you can combine a container platform to quickly spin up isolated environments and use a message queue to simulate asynchronous timing.
4.4 Visual Regression
Pixel-level comparison is easily disturbed by anti-aliasing, font rendering, and animation frames. In engineering practice, region masking, tolerance thresholds, and diff clustering are usually introduced to merge hundreds or thousands of tiny differences into a few categories, which a human then confirms as real regressions or not.
4.5 Defect Localization and Log Analysis
Send the logs, stack traces, and distributed traces of failed cases into a unified logging service and monitoring/alerting system, and let the model perform clustering and rank root cause candidates. Its role is to narrow the investigation scope, not to deliver the final conclusion.
5. Adoption Path: From Scattered Trials to a Fixed Workflow
- Pick one high-frequency pain point, such as regression maintenance cost, and do not roll out five directions at once.
- Define the input contract: requirements templates, API definitions, coding standards, and assertion style, all structured.
- Bind the trigger points: add unit tests on commit, run code review on pull requests, run visual regression at night.
- Set up human gates: all outputs enter a pending-review state first, with pass rate and false positive rate as the core metrics.
- Measure, don’t go by feeling: track test maintenance hours, number of valid defects, false positive rate, and coverage gains, and use data to decide whether to expand the scope.
6. A Capability Map for Newcomers
You do not need to memorize specific product names; you need to remember the capability coordinates: test case and end-to-end automation capability, code-level intelligent generation and review capability, data construction capability, visual comparison capability, and observability and root cause analysis capability. Once you can map each repetitive step to a category of capability and clearly state its input, output, and validation method, you have made the key leap from “knowing how to use a chat box” to “knowing how to design a test engineering system.” As for cloud resources, simply combine general categories such as object storage, container platforms, message queues, logging services, and monitoring/alerting as needed, without binding to any proprietary implementation.
