We use analytics to count visits and form use. It is on unless you reject it. We show no ads on this site.

Glossary

Test harness

Published . Last updated . Published by Zapple.Tech, founded by the founders of CodeceptJS and Codeception, open-source testing frameworks.

Also called
test automation harness, evaluation harness
Published
Updated
Related service
AI agent testing
Definition

A test harness is everything around the code under test that lets you run it and judge the result: the driver that calls it, stand-ins for its dependencies, the test data, the runner and the reporting. You pay for one whenever tests need more than the product itself. An AI agent needs one that also contains its side effects.

What does a test harness contain?

In everyday use, a harness answers the same questions. This is the working definition from practice, not a quote from a standard. How do you call the code? What stands in for the things it depends on? Where does the data come from? Who runs the cases and writes the report?

Part What it does in an ordinary suite What it becomes around an AI agent
Driver Calls the code under test, such as a function, an API or a browser Sends a task to the agent and collects its answer
Stub or fake Replaces a slow or unavailable dependency A sandboxed copy of each tool the agent may call
Fixture and test data Sets up the state a test starts from The task set, plus the files and accounts the agent starts with
Runner Executes cases and isolates them Executes tasks, often several times each
Assertion Decides pass or fail from a known answer A scorer: a rule, a check on the end state or a judge model
Reporting Shows what failed and why A trace of every step the agent took

The word is used for two things. Some teams mean a runnable setup for one product. Others mean a library, such as testharness.js, which the web-platform-tests documentation describes as the framework its JavaScript tests are written in. Harness, the CI/CD company, is a third meaning and has nothing to do with either.

Test harness: everything around the code under test, the driver that calls it, stubs or fakes for its dependencies, the test data, the runner, the assertions and the reporting

Do you need to build a harness, or does your framework already give you one?

Usually your framework gives you most of it. The Playwright documentation says fixtures “are used to establish the environment for each test, giving the test everything it needs and nothing else.” The pytest documentation says fixtures define “the steps and data that constitute the arrange phase of a test.” On the Java side, the JUnit User Guide describes the JUnit Platform as “a foundation for launching testing frameworks on the JVM.” So the runner, setup and isolation come ready-made.

Build something extra only when the product needs it. That is a judgement call, and it usually comes down to three cases:

  • A dependency is paid per call, slow or not built yet, so you need a fake.
  • Tests need data that no framework creates, such as accounts in a state that takes days to reach.
  • Several teams run the same checks and each has copied the setup.

If none of these applies, adding a harness layer is cost without a return. Ask your lead which of the three they have, and ask who maintains the answer. For the framework side of this decision, see our comparison of unit test tools. If the harness has to run in CI, see our guide to building a QA automation pipeline.

What does a harness for an AI agent need that an ordinary one does not?

An agent acts. It calls tools, changes files and sends messages. A harness that lets it do that on live systems is a risk, so the first need is containment: each tool runs against a sandbox or a fake, and nothing leaves it. Inspect, an evaluation framework from the UK AI Security Institute and Meridian Labs, lists “a sandboxing system that supports running untrusted model code in Docker, Kubernetes, Modal, Proxmox, Vagrant, and other systems” among its core features.

The second need is repeat runs. The same task can succeed on one run and fail on the next, so one pass proves little. The third is a trace of every step, because a wrong final answer is hard to fix without seeing the path to it. Inspect describes its building blocks as “datasets, agents, tools, and scorers”, which maps onto the table above.

Our guides to testing AI agents and testing an MCP server go through the cases, and Zapple.Tech builds harnesses as part of the AI agent testing work.

What does a harness not solve?

A harness runs and records. It does not decide what a correct result is. That comes from your success criteria and a labelled set of examples, and someone has to write and keep them. A harness with weak scorers produces tidy reports about the wrong things. It also does not cover what the sandbox leaves out: a fake that drifts from the real service passes tests the real one would fail.

What does Zapple.Tech do about it?

If you are not sure whether your tests need a harness of their own, start with the evidence. Zapple.Tech starts with a one-week QA audit of one product area. It looks at its tests, pipeline and release process, and ends in a written report on what is at risk and what to fix first, plus a pilot plan you can run with Zapple.Tech or without it. Read more on the QA audit and assessment page.

Tell us about your setup in the form below.

  • LLM evaluation

    LLM evaluation is the practice of measuring how a language-model feature or agent behaves on a defined set of tasks, using written success criteria and scores. It does not by itself show the feature is correct. Our AI agent testing builds a task set, a measured baseline and a suite that scores each model, prompt or tool change.

  • AI testing

    AI testing is the testing of software that uses machine learning or large language models, whose outputs vary and cannot always be checked against one fixed answer. Our AI testing services build an evaluation dataset for your AI feature, a baseline of how it behaves today, and checks that run in your CI.

  • RAG evaluation

    RAG evaluation measures a retrieval-augmented generation system in two parts: whether the search step returned the right passages, and whether the answer built from them is supported and useful. Scoring the two separately tells you which one to fix. You need a labelled question set before any score means something.

  • LLM as a judge

    LLM as a judge means using one language model to grade the output of another against a rubric, so a team can score thousands of answers unread by people. It is fast and flexible, but the judge makes its own errors. Trust its score only after you compare it with human labels, and check hard rules without a model.

All terms in the glossary

Test AI

AI agent testing

AI agent testing for task success, tool calls and multi-step behaviour, run in a sandbox. Catch regressions when the model changes. One-week baseline.

See the service

Questions about test harness

What is a test harness?

A test harness is the set of tools and code around the software under test that runs it and records the outcome. It usually holds a driver that calls the code, stubs or fakes for its dependencies, test data, a runner and a report. It runs the tests. It does not decide what a correct result is.

What is the difference between a test harness and a test framework?

A framework gives you the rules for writing and running tests, such as fixtures, assertions and discovery. A harness is the working setup for one product, built on a framework plus your own drivers, fakes, data and environment. Many teams never build a harness separately, because the framework and their fixtures already do the job.

What are the components of a test harness?

The usual parts are a driver that calls the code under test, stubs or fakes for what it depends on, fixtures and test data, a runner that executes the cases, assertions that decide pass or fail, and reporting. For an AI agent, add a sandbox for its tools and a record of each run.

What is an evaluation harness for AI agents?

It is the setup that runs an agent against a set of tasks and scores the results. It supplies the tasks, the tools the agent may call in a sandbox, repeat runs and a record of each step. Open-source tools such as Inspect package datasets, sandboxed tools, scorers and run logs. The scoring rules still come from your own success criteria.

Request a QA audit quote

Tell us what you ship and what worries you.

What happens after you send this

  1. You send the form: your situation and what you need tested, then your name and work email.
  2. Within one business day, we reply with a suggested first step, its scope, timeline and a quote.
  • Fixed scope
  • You decide after each step
  • The tests live in your repository
  • An NDA signed before access

“They helped us to close the positions and consult our team how to proceed further. High-quality quick feedbacks with the deep checking of the required tasks, professional approach, great understanding of the company's technologies and product, detailed reports.”

Kristina Lavrentieva, Manager at keepgo.com, Israel
  • Rated 4.9 out of 5 on Clutch, from 7 client reviews
  • 42 completed test automation and infrastructure projects
  • Founded by the founders of CodeceptJS and Codeception, open-source testing frameworks

Request a QA audit quote

    What is closest to your situation?
    Optional. The product, the platforms, how often you release, what broke last.

    You decide after our reply whether to go ahead.

    Prefer to talk first? Book a call

    One-week QA audit · written report

    Request a QA audit quote