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:

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: