Getting Better Results from AI Coding Agents in QA

SoftwareAI

Maria Filippova

Head of Community at The Top Voices

November 20, 20265 min

Article hero image

AI coding agents can generate automated tests in minutes, but working code does not always mean effective testing. Generated tests may pass while missing important requirements, duplicating existing framework components, or making assumptions about expected behavior. This webinar explores how structured project instructions and task-specific context can help QA engineers guide AI coding agents toward more consistent, reliable, and maintainable results.

Speaker

Yevhen Bozhenko is a Quality Assurance Automation Engineer with over seven years of experience in web, API, and end-to-end test automation. He focuses on applying practical approaches to AI-assisted QA workflows and test automation.

Why AI-Generated Tests Need More Context

AI coding agents can produce technically valid tests without fully understanding the project’s requirements or testing standards.

Common risks include creating new API clients instead of reusing existing components, checking only HTTP status codes, or treating current application behavior as the expected result. Agents may also introduce fixed delays or weaken assertions to make failing tests pass.

The challenge is not simply generating tests faster, but ensuring they verify the right behavior and follow the team’s established practices.

A practical solution is to separate reusable project instructions from the requirements of individual QA tasks.

Building a Reusable Instruction Framework

Instead of repeating the same instructions in every prompt, QA teams can store project context directly in their repositories.

A structured approach uses four files: AGENTS.md defines general working rules, .ai/qa-context.md documents project tools and standards, .ai/framework-guide.md explains existing components and reference tests, and .ai/tasks/<task>.md describes the requirements of a specific task.

Task instructions follow six sections: task, context, constraints, examples, expected output, and validation.

This structure allows an agent to understand which components to reuse, what behavior to verify, which files to avoid changing, and how to check its results.

Once the instructions are available, a short prompt can initiate the workflow without repeating the full project context.

What the Experiments Revealed

The approach was evaluated using a booking API validation task with requirements covering date validation, guest limits, error responses, and successful booking creation.

Nine main runs compared three approaches: no project instructions, reusable project instructions, and project instructions combined with a detailed task file.

All three approaches covered the eight required test cases, and no manual corrections were needed. Across eleven runs, including two additional experiments with missing requirements, ten detected all three deliberately introduced API defects.

The clearest difference was consistency.

Without project instructions, agents generated 15–17 tests. With project instructions alone, they produced 13–16. When a detailed task file was added, all three runs generated the same eight tests while maintaining the required coverage.

The results suggest that structured instructions can make test generation more predictable without necessarily improving already strong baseline coverage.

Handling Missing and Unclear Requirements

One important finding concerned how agents responded to incomplete specifications.

The booking task required validation errors to identify the relevant field but did not specify whether a same-day checkout error should reference checkIn or checkOut.

Without project instructions, agents used the API’s existing response as the expected result. With project instructions, they asked for clarification or explicitly reported their assumptions.

The difference became even clearer when business requirements were removed entirely.

An agent without project instructions generated six tests based on the API definition before requesting clarification. With project instructions, the agent asked for the missing requirements before writing tests.

This distinction matters because existing system behavior does not necessarily represent the correct business requirement.

Verifying That Tests Catch Real Defects

Passing tests alone cannot demonstrate that generated test cases are effective.

To evaluate their usefulness, the generated tests were checked against three deliberately faulty API versions: one incorrectly accepted same-day check-in and checkout dates, another returned the wrong validation field, and a third allowed bookings with nine guests despite an eight-guest limit.

This approach measures whether tests detect incorrect behavior rather than simply pass against the current implementation.

It also reinforces the importance of precise assertions. Checking an HTTP 400 response is not enough when the requirement also specifies an error code and field name.

Conclusion

Getting better results from AI coding agents does not necessarily require longer prompts or more complex tools. A reusable instruction framework can provide the context agents need to follow existing QA standards, produce consistent test coverage, and recognize missing requirements.

The experiments showed that agents already performed well without additional instructions. The main benefits of structured context were more predictable outputs and better handling of uncertainty.

For QA teams adopting AI-assisted automation, the practical starting point is to document existing framework conventions, define clear task requirements, and validate generated tests against real defects.

The goal is not simply to generate more tests, but to produce tests that verify the right behavior and remain useful as the project evolves.



 

4134 views

Stay Ahead in Tech & Startups

Get monthly email with insights, trends, and tips curated by Founders

TECH IMPACTAWARDSGLOBAL

people who move tech forward

powered by

Join 3000+ startups

The Top Voices newsletter delivers monthly startup, tech, and VC news and insights.

Dismiss