MFUPP Preprocessor

The Micro Focus Unit Testing Framework includes a stackable preprocessor (MFUPP) that enables you to instrument a COBOL program during unit test creation without the need to edit the original source code.

It provides the following functionality:

  • Insertions - inserts additional copybooks into the working-storage section and procedure division (via COPY statements) when the source is put under test. These copybooks contain unit test-specific code, allowing you to test source code logic using your own data. All the test code and test data is contained within the copybooks, meaning that no changes are required to the original source under test.
  • Mocking and stubbing - instruments the start of a procedure division or an entry point in the source, allowing that the program to be mocked and stubbed.

The preprocessor enables you to test on a more granular level than a typical unit test: without the preprocessor, the smallest piece of the COBOL source code that can be tested is either a program or an entry-point; using the preprocessor, code can access and test paragraphs and sections.

When compiling using this preprocessor, the program being compiled must have a program-id defined in order that the testing framework can insert the correct copybooks into the code under test, as strict naming conventions for these copybooks is required; see Inserting Test Code into Source Code.

The preprocessor is enabled just as you would any other preprocessor (for example: on the command line, project properties, etc...) and includes a number of directives used to configure its behavior.