Previous Topic Next topic Print topic


Writing Tests

Note: This is a technology preview feature only. It is being made available to allow you to test and provide feedback on this new capability, but it is not intended for production use and is not supported as such. Furthermore, Micro Focus does not guarantee that this feature will be delivered at a GA level and if it is, then the functionality provided might differ considerably from this technology preview. During the preview, you are encouraged to share your feedback and experiences via the Micro Focus community forum - http://community.microfocus.com/microfocus/).

To test elements of your procedural COBOL application, you need to code the testing logic in a test case.

A self-contained 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 self-contained unit test, which uses the copybook, mfunit.cpy (supplied with your installation of Enterprise Developer) 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 COBOL program, 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 data and testing environment (that is, in separate programs). This section also contains an advanced example that demonstrates this technique.

Previous Topic Next topic Print topic