Project Configuration for Self-Contained Unit Tests

The following configurations are made to the unit test project when you create a self-contained unit test:

  • A copybook is created to function as the test program. It is specifically named so that the Micro Focus Unit Testing Framework knows to place it within the Procedure Division ("MFUPD_") of the source program under test - in this case, the source program has a program-id of PROGRAM1. Code your test case within the entry point. To add further test cases, add further entry points.

    Tip: Create an additional copybook, MFUWS_<prog-name>.cpy, to include additional working storage items that your test case requires for the test run. <prog-name> must be the same name as used for your MFUPD_ copybook.

    Entry point for self-contained test code

  • A linked copy of the source program is also added to the unit test project that contains the self-contained test case:

    Solution Explorer for a self-contained unit test

  • The mfupp preprocessor is applied to the linked source program, at file level:

    mfupp preprocessor configuration

  • General unit test project settings are also applied to the project during its creation; you should not need to alter these options. The Directives in Comments setting indicates that the Directives in Comments directive is in effect, usually required for mainframe unit tests.

    Project settings for a self-contained unit test

    Additionally, Compiler directives and copybook paths are copied from the source project. However, if those subsequently change, they must be manually updated in the unit test project.