Test harness structure

Test harnesses contains all the information required to compile and run a test. This includes, test cases, source files under test, stubs, and Target Deployment Port (TDP) configuration settings.
These test assets include:
  • Test cases
  • Stubs
  • Required source files, including:
    • Tested files: These are source files under test. The functions of these components are instrumented and integrated into the test harness.
    • Additional sources: These are dependency files that are added to test harness, but are not tested or instrumented. For example: resource files can be compiled inside a test harness by specifying them as additional files.
    • Linked files: These are source files that are linked with the test harness but are not tested or instrumented.
    • Libraries: These are libraries that are required for the link. For example: math libraries.

To run a test harness, it must be associated with a test configuration. You can do this in a run configuration or in a test campaign.

You can use the test harness editor to add and remove test assets from the test harness and to graphically arrange the order in which the test cases are run. You can also add additional blocks of code and conditions to structure the behavior of the test harness.

Activity flow chart

The Activity area is located on the left of the test harness editor and contains a flow chart, which describes the behavior of the test harness. You can use this flow chart to define the order in which each test case is run.

The Activity flow chart can contain blocks of native code, which can be run before or between test cases. This can be useful for setting parameters or changing hardware to a specific configuration before running the test case.

You can also add decision blocks, making the execution of paths in the flow chart conditional.

The calls of test cases in a test harness are all taken into account by default when a test harness is run but you can deactivate a test case from the activity flow chart so that it is not taken into account in the generation.

Test harness details

In addition to the behavior of the test, the test harness includes information that is required to run the test. The Details section contains the following pages:
  • Context Definitions: This page lists the source code assets that are required to run the test.
    • Tested files: These are source files under test. The functions of these components are instrumented and integrated into the test harness.
    • Additional sources: These are dependency files that are added to test harness, but are not tested or instrumented. For example: resource files can be compiled inside a test harness by specifying them as additional files.
    • Linked files: These are source files that are linked with the test harness but are not tested or instrumented.
    • Libraries: These are libraries that are required for the link. For example: math libraries.
  • Build Instrumentation: This page contains the configuration settings that are used to build the test. These settings override the default configuration settings of the project.
  • Stubs: This page specifies any stub files that simulate functions that are required by the functions under test. Stubs can be used to replace functions that are under development or not practical to use for testing. They can also be used to inject specific values or conditions into the test.
  • Requirements: This page allows you document the requirements for the test case.
  • Header Code: This page contains code that is run before the test cases are executed.
  • Declarations: This page specifies global and local variables that must be declared in the test harness.
Feedback