Determining a Test Outcome

Failing COBOL syntax within a test case causes the test to fail and displays the standard COBOL error messaging in the test case summary, within the test output.

To control the outcome of a test case, you can place assertions within your test code that determine a failing or successful test. You can manually set a non-zero return code to mark a test as failed, or you can conditionally call one of the following library routines:

MFU_ASSERT_FAIL
Signifies that a test case running under the Micro Focus Unit Testing Framework has failed, and outputs a message to the test report.
MFU_ASSERT_FAIL_Z
Signifies that a test case running under the Micro Focus Unit Testing Framework has failed, and outputs a null-terminated message to the test report.
MFUFMSG
Signifies that a mainframe test case running under the Micro Focus Unit Testing Framework has failed, and outputs a message to the test report. (Mainframe dialects.)
MFUFMSGZ
Signifies that a mainframe test case running under the Micro Focus Unit Testing Framework has failed, and outputs a null-terminated message to the test report. (Mainframe dialects.)

These all mark the test as failed, and enable you to include user-defined messages within a test report.

To use these library routines, ensure that your test cases can access the mfunit_prototypes.cpy copybook. This copybook is supplied in the cpylib sub-directory of your installation directory, and is used for call prototyping when you call any of the above library routines.

Test cases that run to completion without any of the above occurring or are coded to return a return code of zero are considered to have passed.