The elements of a complete test fixture are coded as entry points in a COBOL program. The entry points shown here are using call prototypes found in the mfunit.cpy copybook, available from the cpylib folder of your product installation directory. If you are unable to use the copybook due to its level-78 items, which are not supported with mainframe dialects, you must specify the following entry point names:
Element | Entry point |
---|---|
test setup | MFUS_test_case_name |
test metadata setup | MFUM_test_case_name |
test case | MFUT_test_case_name |
test teardown | MFUE_test_case_name |
global metadata | MFUGM_program_name |
global command line arguments | MFUGA_CMDOptions |
The main elements are:
... entry MFU-TC-SETUP-PREFIX & "MyTestCase" //initial setup code goes here// goback ...
... entry MFU-TC-METADATA-SETUP-PREFIX & "MyTestCase" //initial metadata setup code goes here// goback ...
... entry MFU-TC-PREFIX & "MyTestCase" //test case code goes here// goback ...
... entry MFU-TC-TEARDOWN-PREFIX & "MyTestCase" //clean-up code goes here// goback ...
If you have multiple test cases, each must have their own setup and teardown. COBOL programs that contain more than one test fixture are commonly referred to as test suites.
These sections can appear in your code in any order, but are run in the order shown here.
There are also other elements that affect a test case, either by applying a number of attributes (metadata) to the test cases, or setting command line options for the test run:
... entry MFU-GLOBAL-COMMANDLINE-PREFIX & "MyProgramName" //global command line arguments here// //for example: move "-verbose -high-res-timer:true -report:markdown to MFU-GLOBAL-COMMANDLINE-ARG goback ...
... entry MFU-GLOBAL-METADATA-PREFIX & "CMDOptions" //global metadata is set up here// goback ...