What is Test Harness?

Test harness enables the automation of tests. It refers to the system test drivers and other supporting tools that requires to execute tests. It provides stubs and drivers which are small programs that interact with the software under test.

Test harness execute tests, by using a test library and generates a report. It requires that your test scripts are designed to handle different test scenarios and test data.

What is TEST HARNESS? Software Testing Tutorial

Why use 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 code level
  • Increase the productivity of the system thorough automation
  • Enhance the quality of software components and application
  • To handle the complex condition that testers are finding difficult to simulate

There are two context 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

  • Junit: Tool used while using Java
  • Nunit: Tool used for using .Net framework

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 environment in which automated tests are designed and implemented
  • You can not "Record & Playback" script in Test Harness
  • 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, testing platform, etc.
  • Test harness is categorized into
    • Automation testing
    • Integration testing
  • Automation framework is categorized as
    • Data driven testing
    • Keyword driven testing
    • Modularity driven testing
    • Hybrid testing
    • Model based testing
    • Code driven testing
    • Behavior driven testing