test harness

Contributor(s): Alexander Gillis

In software development, a test harness is a collection of software and test data used by developers to unit test software models during development. A test harness will specifically refer to test drivers and stubs, which are programs that interact with the software being tested. Once a test harness is used to execute a test, they can also utilize a test library to generate reports.

Test harnesses are made up of test execution engines and test script repositories. A test execution engine is the software used to perform the test, not the software being tested. The test script repository is the location where test scripts and cases are stored.

Test harnesses are used in two main areas, automation testing and integration testing. Test harnesses in automation testing will use test scripts (commonly written in JAVA , Python and Ruby) to automate the software testing process. Once a test is executed, the results can be used to generate a test report. A test harness in integration testing is used to test the integration of two sets of code so they can interact with one another. Integration testing will ensure both sets of code are working as predicted, in a single unit. Test cases will also be written and executed with an automation script.

Some benefits of test harnesses include the automation of the testing process, generation of test reports, supporting of debugging modes and earlier identification of bugs.

Test harness vs test framework

Test harnesses are similar to, but not the same as testing frameworks. While test harnesses are the collection of software and test data used to test a program, test frameworks are the set of processes and procedures which automated tests are designed and implemented through. Test harnesses are used in automation testing and integration testing; however, test frameworks can be used in multiple scenarios such as data-driven, behavior-driven and keyword driven tests. Additionally, test frameworks require information such as a test library, testing software and a testing platform.

This was last updated in February 2019

Continue Reading About test harness

Dig Deeper on Automated and autonomous testing

Join the conversation


Send me notifications when other members comment.

Please create a username to comment.

What testing software do you use in your test harness?
I think that limiting the test harness concept to unit testing is arguably obsolete. Today I personally advocate focusing most testing at an integration level, and that requires a test harness as well for early "shift left" integration testing, although at the end of the pipeline one should deploy to a real production-like setting and test there as well. A shift-left test harness (for early integration testing) entails mocks of some enterprise services (e.g., authentication) and provides the services (e.g., a local Kubernetes cluster) to enable the developer to do local "full stack" deployments that are sufficiently complete for functional integration testing.