Create a Unit Test Project and Test Program

Use this process if you are creating unit tests that are to call into existing application logic. The unit test project will be stored in the same solution as the logic. This process also automatically creates a test program, containing the required links to immediately start calling into the application logic. For ease of use, we recommend that you organize your solution/projects as described in Organizing Your Projects when using this process.
  1. Ensure that the solution containing to application logic to be tested is open.
  2. Double-click the .cbl file containing the code on which to test.

    The COBOL code is displayed in the editor.

  3. Right-click anywhere in the editor, then select Create Unit Test.

    The Create Unit Test dialog box appears.

  4. In the Test project field, click and select <New Test Project>.
    Tip: If any unit test projects already exist in the solution, selecting an existing one here, adds further unit tests to it.
  5. In the New test project name field, type a name for the new project. The Project Location field also defaults to the value you enter.
  6. In the Project location field, type the name for the new directory that the project files will be placed.
  7. In the New test program name field, type the name of the test program file (.cbl file) to contain your tests.
    Note: You can add more of these files later, if required.
  8. In the dialog box for entry points, specify the name of the entry point name and the name of the test case as required.
  9. Click Add New if you want to specify any other entry points for which you want to generate test cases. This adds a new line to the dialog box containing the entry points. Use the drop-down list to select the entry point.
  10. Click OK.

    The unit test project is created.

Note the following elements that have been created:
Note: The following excerpts were a result of performing the above instructions on the AirportDemo project.
  • The two copybooks required by the Micro Focus Unit Testing Framework are copied into the project.

  • A test setup and a test case have been created.

  • A procedure pointer has been added to the test setup that enables you to call into the application logic.

  • The Linkage section from the source program has been replicated in the Working-storage section, initialized, and a CALL statement coded in a test case.

  • The Output path is set to the same directory as the output path for the application logic's project.