This article needs additional citations for verification. (January 2023) |
In software testing, a test harness is a collection of stubs and drivers configured to assist with the testing of an application or component.[1][2] It acts as imitation infrastructure for test environments or containers where the full infrastructure is either not available or not desired.
Test harnesses allow for the automation of tests. They can call functions with supplied parameters and print out and compare the results to the desired value. The test harness provides a hook for the developed code, which can be tested using an automation framework.
A test harness is used to facilitate testing where all or some of an application's production infrastructure is unavailable, this may be due to licensing costs, security concerns meaning test environments are air gapped, resource limitations, or simply to increase the execution speed of tests by providing pre-defined test data and smaller software components instead of calculated data from full applications.
These individual objectives may be fulfilled by unit test framework tools, stubs or drivers.[3]
Example
When attempting to build an application that needs to interface with an application on a mainframe computer, but no mainframe is available during development, a test harness may be built to use as a substitute this can mean that normally complex operations can be handled with a small amount of resources by providing pre-defined data and responses so the calculations performed by the mainframe are not needed.
A test harness may be part of a project deliverable. It may be kept separate from the application source code and may be reused on multiple projects. A test harness simulates application functionality; it has no knowledge of test suites, test cases or test reports. Those things are provided by a testing framework and associated automated testing tools.
A part of its job is to set up suitable test fixtures.
The test harness will generally be specific to a development environment such as Java. However, interoperability test harnesses have been developed for use in more complex systems.[4]
References
- ^ "Test Harness". ISTQB Glossary. Retrieved 10 September 2023.
- ^ Rocha, Camila Ribeiro; Martins, Eliane (2008). "A Method for Model Based Test Harness Generation for Component Testing". Journal of the Brazilian Computer Society: 8. Retrieved 10 September 2023.
- ^ ISTQB Exam Certification - "What is Test harness/ Unit test framework tools in software testing?", accessed 19 October 2015
- ^ Ricardo Jardim-Gonçalves, Jörg Müller, Kai Mertins, Martin Zelm, editors, Enterprise Interoperability II: New Challenges and Approaches, Springer, 2007, p. 674, accessed 19 October 2015
Further reading
- Pekka Abrahamsson, Michele Marchesi, Frank Maurer, Agile Processes in Software Engineering and Extreme Programming, Springer, 1 January 2009