Creating Unit Test Projects and Tests

You can create unit tests to test your native COBOL and mainframe COBOL code.

The test code is stored in test programs, which are stored in Unit Test Library projects. Usually, these projects are stored in the same solutions as the source code that they are testing, so that they call into the source whilst running a test. Alternatively, if you have a standalone test, where the test program contains both the source code and the test code, the Unit Test Library project may be stored in its own solution.

For tests that call into the separate source code, it is recommended to initiate the creation of a unit test from within the source code, as the wizard will create the test program and Unit Test Library project and include the necessary configuration to call into the source code. The type of test program you create through the wizard depends on the testing scenario; see Types of Unit Test for more details.

If you manually create a Unit Test Library project, you can start writing your standalone tests, or must configure the project and test programs to call into another source from within that solution.

Whichever way that the test program is created, the basic structure of a test case is already laid out in the program; see Elements of a Test Case for details on each section.