Definition

test harness

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 Software testing tools and techniques