To test elements of your procedural COBOL application, you need to code the testing logic in a test case.
A stand-alone unit test is a single COBOL program that includes the test case and the data to be tested. Special entry points in your unit test enable you to set up the data and testing environment (the setup), include the testing logic, and then tidy it up again after the test has run (the teardown). These three elements together make up a test fixture.
This section includes a simple test fixture that demonstrates a complete standalone unit test, which uses the copybook, mfunit.cpy (supplied with your installation of Visual COBOL) to resolve to the correct entry point names that the test runner will recognize. For details of the test fixture syntax, see Elements of a Test Fixture.
If you have related test cases, you can include these in the same standalone fixture file, each with their own test setup and teardown. COBOL programs that contain more than one test case are referred to as test suites.
You may also write unit tests where the testing logic is completely separate from the source code to be tested (that is, in separate programs). This section also contains an advanced example that demonstrates this technique.
There is also a third type of technique that also keeps the source code and testing code separate. This technique keeps the testing code self-contained in copybooks, and uses the MFUPP preprocessor to inject them into the source program when it is run through the Micro Focus Unit Testing Framework; see MFUPP Preprocessor.