Previous Topic Next topic Print topic


Using Dynamic Metadata

You can use dynamic metadata in a test case by including an extra entry point with the prefix MFUM which is called during the preparation stage of the test case. During the execution of the entry point, you can update the metadata for the test case by changing various MFU-MD fields exposed through the mfunit.cpy copybook.

This approach is an alternative to specifying the metadata for a test case in the text fixture (.mfu) file.

Description Tag in the text fixture .mfu file COBOL field Changeable in MFUM
Test case name [name] MFU-MD-TESTCASE No
Test case description description MFU-MD-TESTCASE-DESCRIPTION Yes
Test timeout in ms timeout MFU-MD-TIMEOUT-IN-MS Yes
Test case traits traits MFU-MD-TRAITS Yes

Example

      $set case sourceformat"variable"
       copy "mfunit_prototypes.cpy".
       program-id. MFUT_METADATA.
       working-storage section.
       copy "mfunit.cpy".
       procedure division.
       test-it.
           exhibit named MFU-MD-TESTCASE                    *> Read-ONLY  
           exhibit named MFU-MD-TESTCASE-DESCRIPTION  
           exhibit named MFU-MD-TIMEOUT-IN-MS
           exhibit named MFU-MD-TRAITS
           goback returning return-code.
           .

       entry "MFUM_METADATA".
           move "This is an example of a dynamic description" to MFU-MD-TESTCASE-DESCRIPTION
           move 3000 to MFU-MD-TIMEOUT-IN-MS
           move "smoke" to MFU-MD-TRAITS
           set MFU-MD-SKIP-TESTCASE to false
           goback.
Previous Topic Next topic Print topic