What is Test Harness

Definition

A test harness is the collection of software and test data configured to run a set of tests under controlled conditions, providing the stubs, drivers, and execution environment needed to invoke the code under test and capture its results automatically.
« Back to Glossary Index
  • Automates execution of tests by supplying drivers, stubs, and setup
  • Provides a controlled, repeatable environment for running test cases
  • Captures and reports results consistently across runs
  • Lets components be tested before their dependencies are complete

Real World Example

A team building a billing module that depends on an unfinished payments service uses a test harness with stubbed responses, so they can run and validate the billing logic in isolation before the real service exists.

FAQs

What does a test harness contain?

It typically contains test drivers that invoke the code, stubs or mocks for dependencies, test data, and result-capture mechanisms.

How does a harness differ from a framework?

A framework defines structure and conventions for writing tests, while a harness is the assembled environment and scaffolding that actually executes them.

Why use a test harness?

It enables automated, repeatable testing of components in isolation, even when their real dependencies are unavailable.

Hello popup window