Unit Testing Code Templates

Your IDE editor contains a number of snippets relating to the Micro Focus Unit Testing Framework; to insert one, type the shortcut in your editor and press Ctrl+Space. The snippet is inserted into the code, and you are prompted to enter the test case name: either select the name from a list of level-78 constants that are defined in the program, or type a literal string.

Tip: Before creating a test case, create a level-78 constant for <test-case-name>; the value of this is offered from a list when inserting the template. Using the constant in the entry point names eradicates any spelling mistakes that may occur when creating the different elements for the test.
shortcut snippet description
testcase
entry mfu-tc-prefix & <test-case-name>.
   *> Test code goes here.
   goback returning MFU-PASS-RETURN-CODE
   .
The main element of a test case. It's the section that contains the actual testing logic and test assertions.
testdata
entry mfu-tc-metadata-setup-prefix & <test-case-name>.  *> the test case meta data
  move "ex. of a dynamic description" to mfu-md-testcase-description
  move 10000 to MFU-MD-TIMEOUT-IN-MS
  move "smoke,dynmeta" to MFU-MD-TRAITS
  set MFU-MD-SKIP-TESTCASE to false
  goback returning 0
  .
An optional element to a test case. It's the section that associates metadata with the test case. See Using Dynamic Metadata for more information on how to use the options shown here.
testsetup
entry mfu-tc-setup-prefix & <test-case-name>.  *> the test case setup
  goback returning 0
  .
An optional element to a test case. It's the section that sets up the environment before the testing logic is run.
testteardown
entry mfu-tc-teardown-prefix & <test-case-name>. *> the test case tear-down
  goback returning 0
  .
An optional element to a test case. It's the section that tidies up after the testing logic has run.