What is Test Harness? (Examples)

Test Harness in Software Testing

Test Harness in Software Testing is a collection of stubs, drivers and other supporting tools required to automate test execution. Test harness executes tests by using a test library and generates test reports. Test harness contains all the information needed to compile and run a test like test cases, target deployment port(TDP), source file under test, stubs, etc.

 

Why use Test Harness?

Test Harness

  • Automate the testing process
  • Execute test suites of test cases
  • Generate associated test reports
  • Support for debugging
  • To record the test results for each one of the tests
  • Helps the developers to measure code coverage at a code level
  • Increase the productivity of the system through automation
  • Enhance the quality of software components and application
  • To handle the complex condition that testers are finding difficult to simulate

There are two contexts where Test Harness is used

  1. Automation testing: It contains the test scripts, parameters necessary to run these scripts and gather results to analyze it
  2. Integration testing: It is used to put together two units of code or module that interact with each other to check whether or not the combined behavior is as expected or not

Test Harness Tools

Test Harness Vs Test Framework

Test Harness Test Automation Framework
A test harness is composed of drivers and stubs, which are small dummy programs that interact with the software under test It is a set of processes, procedures, abstract concept and an environment in which automated tests are designed and implemented
You can not “Record & Playback” script in Test Harness A tester can manually “Record & Playback” script in this framework
Test harness contains all the information needed to compile and run a test like test cases, target deployment port(TDP), source file under test, stubs, etc. Test automation framework contains information like test library, testing tools, automated testing practices, a testing platform, etc.
A test harness is categorized into
Automation Testing
Integration Testing
Automation framework examples
Data-driven testing
Keyword driven testing
Modularity driven testing
Hybrid testing
Model-based testing
Code driven testing
Behavior-driven testing