# Regression testing

> Regression testing is re-running a system's existing tests after every change to confirm that features which already worked still work, catching new bugs or quality drops before they reach users.

Also called: regression tests, regression suite, non-regression testing, automated testing. Category: Delivery and quality. Source: https://aibuildindex.com/glossary/regression-testing

## In the index

- AI SaaS MVP: median $4,000, middle half $870 to $10,000, 7,123 priced briefs (https://aibuildindex.com/cost/ai-saas-mvp)
- Fix an AI-built app: median $2,900, middle half $500 to $8,400, 552 priced briefs (https://aibuildindex.com/cost/vibe-coded-app-rescue)

Fixing one thing often breaks another. Regression testing guards against that. Each time the code, a prompt, a model or a dependency changes, the system is run through a set of tests covering what already worked. If something that passed yesterday fails today, the change caused a regression and is fixed before release. For a buyer, a regression suite is what makes it safe to keep improving a system after launch.

## How it works

A regression suite builds up as the project goes on. Each feature gets tests when it is built, and each bug, once fixed, gets a test so that it cannot return unnoticed. The suite usually runs automatically through a [CI/CD](https://aibuildindex.com/glossary/ci-cd) pipeline whenever code changes, and again in a [staging environment](https://aibuildindex.com/glossary/staging-environment) before release.

AI systems need two kinds of regression test:

- **Code tests** check the ordinary software: that integrations connect, data is saved correctly and errors are handled. These pass or fail cleanly.
- **Behaviour tests** check the AI's outputs. A change of prompt or model version can improve some answers and worsen others. Running [evals](https://aibuildindex.com/glossary/evals) on a fixed [golden dataset](https://aibuildindex.com/glossary/golden-dataset) shows whether the overall score held, and which cases changed.

The second kind matters more than many buyers expect. A small wording change to a prompt can quietly alter how a model handles edge cases, and without a fixed set of examples nobody notices until a user complains.

## What it means for cost

Writing tests adds time to a build, so quotes that include a real test suite will usually be higher than those that do not. The saving comes later: each change can be made and checked quickly, instead of being followed by manual checking or user-reported bugs. Systems with no tests tend to become expensive to change, which is one of the main causes of [technical debt](https://aibuildindex.com/glossary/technical-debt).

Ask a builder:

- Will the system have automated tests, and what do they cover?
- How are prompt and model changes tested?
- Do tests run automatically on every change?
- Will we receive the tests at handover and be able to run them?

## Common mistakes

Testing only the happy path. Treating AI outputs as untestable because they vary. Letting failing tests be switched off to meet a deadline.

## Common questions

### Why do AI systems need regression testing if the code has not changed?

Because behaviour can change without code changes. A provider may update the model, or a prompt may be edited in a settings screen. Re-running behaviour tests on a fixed set of examples catches these shifts.

### How long does it take to build a regression suite?

It grows alongside the system, so the cost is spread over the build rather than paid in one block. Adding tests to a system that was built without them is slower and costlier, because the builder must first work out what the system is supposed to do.

## Related terms

- [Evals (AI evaluation)](https://aibuildindex.com/glossary/evals): Evals are structured tests that measure how well an AI system performs on a fixed set of realistic inputs, scoring its outputs so that changes to prompts, models or data can be judged by evidence rather than impression.
- [Golden dataset](https://aibuildindex.com/glossary/golden-dataset): A golden dataset is a carefully checked set of real example inputs paired with their correct outputs, kept fixed and used as the reference for measuring whether an AI system gives the right answers.
- [CI/CD](https://aibuildindex.com/glossary/ci-cd): CI/CD, short for continuous integration and continuous delivery, is an automated pipeline that tests every code change as it is made and prepares or releases it, so updates reach production quickly and safely.
- [Code review](https://aibuildindex.com/glossary/code-review): Code review is the practice of having a second developer read and check code changes before they are merged, to catch bugs, security problems and unclear design, and to keep the codebase understandable to more than one person.
- [Staging environment](https://aibuildindex.com/glossary/staging-environment): A staging environment is a copy of the live system, set up as close to production as possible but without real users, where changes are tested and reviewed before they are released.
- [User acceptance testing (UAT)](https://aibuildindex.com/glossary/user-acceptance-testing): User acceptance testing (UAT) is the final check before go-live in which the buyer's own staff use the system on realistic tasks to confirm it does what the business needs and meets the agreed acceptance criteria.
