Test Output Examples

The following excerpt is taken from the tutorial, and demonstrates how to set the outcome of a test case (if the condition is not met) to failed.

...
           if function numval(distance-km) not equal 4787
               string "Incorrect distance in kilometers returned - " 
                       distance-km delimited by size
                       x"0" delimited by size
                       into errormessage
               end-string
               call MFU-ASSERT-FAIL-Z using errormessage
           end-if
...

This code will also display the errormessage text in the output pane if distance-km is not equal to 4,787:

GUID-180C105C-7865-473A-AFD9-C1F618C0C48A-low.png

Note: The System Out section is populated as the result of normal DISPLAY statements processed during the test.

Another way to assert a test to have failed is to set a non-zero return code:

move 1 to return-code

Or (when using mfunit.cpy):

goback returning MFU-FAIL-RETURN-CODE

This results in the following output:

GUID-F00311B0-872E-4D55-AE18-190853646DE7-low.png