Use the following example to inject unit test code into your source code, and then run it through the Micro Focus Unit Testing Framework. The test uses hard-coded data specified within the test code.
It consists of two files, which can be found in the appendix:
cobol Fizzbuzz.cbl int"" preprocess"mfupp" verbose endp;
mfurun Fizzbuzz.int
As the program runs, it executes the code in the entry point within MFUPD_Fizzbuzz.cpy, which in turn executes the Process-Number section of the original source code, testing it against its own data.
Use the following example to inject data-driven unit test code into your source code. This example requires an additional copybook to inject the fields from the data file into the working-storage section, and then uses the values in the referenced .csv file to iterate through the test code..
It consists of four files, which can be found in the appendix:
cobol Fizzbuzz.cbl int"" preprocess"mfupp" verbose endp;
mfurun -verbose:true Fizzbuzz.int
As the program runs, it executes the code in the entry point within MFUPD_Fizzbuzz.cpy a number of times (once for each value in fizzbuzz_data.csv), each time executing the Process-Number section of the original source code.