25.16. UnitTest

25.16.1. Overview

The UnitTest sensor data type is designed for representation of the outcome of single unit test invocation on a source file in a tool and language independent manner. Table 25.20, “UnitTest SDT attributes” documents its attributes.

Table 25.20. UnitTest SDT attributes

AttributeDescription
tstampThe UTC time at which this data was collected.
toolA string indicating the tool that collected this data, such as "JUnit".
resultA string that should specify either 'pass' or 'failure'.
pathThe fully qualified file path to the file containing the test cases that were run.
nameThe name of the test case.

25.16.2. Applications of the UnitTest SDT

The Ant build tool supports invocation of JUnit tests. A sensor for Ant represents this data as UnitTest entries.

Once collected, UnitTest data can be used to track trends in the success rate of unit tests associated with a system as it is developed, and to investigate potential relationships between test success/failure and other product or process measures, such as size, defects, time, dependencies, build failures, and so forth.