Using Dynamic Metadata

You can add metadata about a test case in your source code.

The Micro Focus Unit Testing Framework contains a number of COBOL fields within the mfunit.cpy copybook that enable you to add metadata to your test cases.

For metadata relating to a particular test case, set the COBOL fields within the MFU-TC-METADATA-SETUP-PREFIX & test-case-name entry point. (If you are unable to use level 78 constants, use the "MFUM_test-case-name" entry point name instead.) This entry point is called during the preparation stage of the test case.

For metadata relating to all test cases in your test suite, set the COBOL fields within the MFU-GLOBAL-METADATA-PREFIX & program-name entry point. (If you are unable to use level 78 constants, use the "MFUGM_program-name" entry point name instead.) This entry point is called before any of the test cases.

If you generate a test fixture file (.mfu file) from the test suite, you can see the metadata within the test cases, and in the [global] section.

Use the following COBOL fields to populate your test case-specific and global metadata entry points:

COBOL field Description Tag in the test fixture .mfu file
MFU-MD-TESTCASE-DESCRIPTION Test case description description
MFU-MD-TIMEOUT-IN-MS

The time limit (in ms) in which the test case should run. A non-zero return code is returned if the timeout is reached. The timeout must be set to at least 3 seconds.

timeout
MFU-MD-TRAITS Test case traits. You can run test cases based on the trait; any tests that are not assigned the specified trait are skipped during the test run.
Tip: You can add more than one trait, delimited by a comma, if required.
traits
MFU-MD-SKIP-TESTCASE Skip test case skipped
MFU-MD-TESTCASE-PRIORITY Give priority to a test case. Permissible values are:
  • MFU-MD-TESTCASE-PRIORITY-HIGH
  • MFU-MD-TESTCASE-PRIORITY-MEDIUM
  • MFU-MD-TESTCASE-PRIORITY-LOW
Note: Any test cases that do not have a priority specified are run after all prioritized test cases have run.
priority
MFU-GLOBAL-COMMANDLINE-ARG Applies test runner arguments to the test run. Use this field in the MFU-GLOBAL-COMMANDLINE-PREFIX entry point.
Note: The length of this field is limited to 128 characters.
various