In
software testing
Software testing is the act of examining the artifacts and the behavior of the software under test by validation and verification. Software testing can also provide an objective, independent view of the software to allow the business to apprecia ...
, a test harness or automated test framework is a collection of
software
Software is a set of computer programs and associated documentation and data. This is in contrast to hardware, from which the system is built and which actually performs the work.
At the lowest programming level, executable code consists ...
and test data configured to test a program unit by running it under varying conditions and monitoring its behavior and outputs. It has two main parts: the
test execution engine {{unreferenced, date=November 2008
A test execution engine is a type of software used to test software, hardware or complete systems.
Synonyms of test execution engine:
* Test executive
* Test manager
* Test sequencer
A test execution engine may ...
and the
test script
A test script in software testing is a set of instructions that will be performed on the system under test to test that the system functions as expected.
Types of test scripts
There are various means for executing test scripts. These last two ...
repository
Repository may refer to:
Archives and online databases
* Content repository, a database with an associated set of data management tools, allowing application-independent access to the content
* Disciplinary repository (or subject repository), an ...
.
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 is a
hook
A hook is a tool consisting of a length of material, typically metal, that contains a portion that is curved or indented, such that it can be used to grab onto, connect, or otherwise attach itself onto another object. In a number of uses, one e ...
to the developed code, which can be tested using an
automation framework.
A test harness should allow specific tests to run (this helps in optimizing), orchestrate a runtime environment, and provide a capability to analyze results.
The typical objectives of a test harness are to:
* Automate the testing process.
* Execute test suites of test cases.
* Generate associated test reports.
These individual objectives may be fulfilled by unit test framework tools, stubs or drivers.
A test harness may provide some of the following benefits:
* Increased productivity due to automation of the testing process.
* Increased probability that
regression testing
Regression testing (rarely, ''non-regression testing'') is re-running functional and non-functional tests to ensure that previously developed and tested software still performs as expected after a change. If not, that would be called a '' regre ...
will occur.
* Increased quality of software components and application.
* Repeatability of subsequent test runs.
* Offline testing (e.g. at times that the office is not staffed, like overnight).
* Access to conditions and/or use cases that are otherwise difficult to simulate (load, for example).
Alternative definition
An alternative definition of a test harness is software constructed to facilitate
integration testing. Where
test stubs
In advanced polymorphism computer science, test stubs are programs that simulate the behaviours of software components (or modules) that a module undergoing tests depends on. Test stubs provide canned answers to calls made during the test, usuall ...
are typically components of the application under development and are replaced by working components as the application is developed (
top-down integration testing
Top-down may refer to:
Arts and entertainment
* " Top Down", a 2007 song by Swizz Beatz
* "Top Down", a song by Lil Yachty from ''Lil Boat 3''
* "Top Down", a song by Fifth Harmony from ''Reflection'' Science
* Top-down reading, is a part of ...
), test harnesses are external to the application being tested and simulate services or functionality not available in a test environment.
For 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.
A test harness may be part of a project deliverable. It is 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 fixture
A test fixture is an environment used to consistently test some item, device, or piece of software. Test fixtures can be found when testing electronics, software and physical devices.
Electronics
In testing electronic equipment such as circuit ...
s.
The test harness will generally be specific to a development environment such as
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
. However,
interoperability
Interoperability is a characteristic of a product or system to work with other products or systems. While the term was initially defined for information technology or systems engineering services to allow for information exchange, a broader defi ...
test harnesses have been developed for use in more complex systems.
[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
References
Further reading
* Pekka Abrahamsson, Michele Marchesi, Frank Maurer, ''Agile Processes in Software Engineering and Extreme Programming'', Springer, 1 January 2009
{{Authority control
Software testing