unitTest Option

The unitTest method option indicates that the method is a unit test method.

The unit test method cannot have parameters or return a result.

The test fails if an assertion method fails or an exception is raised. Any failure associated with a method will count as a failure only in the final failure statistics, whether it is a failure resulting from any of the previous items in this list or from a failure in the unitTest method.

The unitTest method option in the following example identifies a unit test method that is executed.

add() unitTest;
begin
   calculator.add(1);
   calculator.add(1);
   assertEquals(calculator.getResult(), 2);
end;

The unitTest method option cannot be combined with the typeMethod method option.