Prev Next

Testpoint Editor

The Testpoint Editor is used to compose constraints for Classes and Operations. The types of constraints permitted are dependent on the selected object. For Classes, the type will always be Invariant. For operations, the type can be either Pre-Condition, Post-Condition or Line-Condition.

Invariants are evaluated by the Analyzer when any method called on an object of the selected Class type completes. Pre-conditions are evaluated at the beginning of each call to the specified operation. Post-conditions are evaluated upon completion of each call to the specified operation. Line-conditions are evaluated each time the specified line of code is executed.

Access

Ribbon

Execute > Analyze > Testing > Show Testpoints Window : Double-click on a Class or Operation in the Testpoints window

Constraint Group fields

Field

Usage

See also

Type

The type of constraint for the selected Class or Operation:

  • Invariant - Evaluated after any method called on the specified Class has completed
  • Pre-Condition - Evaluated at the beginning of each call to a specific Operation
  • Post-Condition - Evaluated after completion of each call to a specific Operation
  • Line-Condition - Evaluated upon execution of a specific line of code within an Operation

Offset

For Line-Conditions only, the Line number within the specified operation upon which to evaluate the constraint.

An offset value is automatically set if the Testpoint was created using the Code Editor context menu.

Code Editor Context Menu

Condition

The constraint to be evaluated when this Testpoint is triggered. A status of pass or fail will be recorded depending upon whether this constraint condition evaluates as true or false.

Constraint Composition

Action on Fail

Click on the drop-down arrow and select from the three options:

  • 'Continue' - ignore failure of this constraint and continue execution
  • 'Break execution' - halt execution and display the Stack trace
  • 'Disable on fail' - do not execute the constraint again after failing once

Evaluate When

(Optional) An additional constraint which must be met before the main Testpoint Condition is evaluated, providing greater control over test coverage.

Constraint Composition

Trace Group fields

Option

Action

See also

Level

Specifies when the trace statement (if defined) will be output. Available options are:

  • 'Fail Only' - Output trace statement only when this Testpoint condition fails
  • 'Always' - Output trace statement every time this Testpoint is evaluated

Statement

(Optional) A message to be output when this Testpoint is evaluated.

Variables currently in scope can be included in a trace statement output by prefixing the variable name with a $ token for string variables, or a @ token for primitive types such as int or long.

Output from a Trace Statement can be directed either to the 'Testpoints' tab of the System Output Window, or to an external file, as configured by the Analyzer Script for the parent Package.

Specifying a Trace Statement

Learn more