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 GUID-1E3884E8-1DFD-4408-A21D-2D5ED6DEA450-low.png 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. 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.

    GUID-9912E57C-EA8D-4E62-B687-BA225D09D7FE-low.png

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

    GUID-8A82D311-0A55-44AF-960A-35D9718F846A-low.png

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

    GUID-3A3AB84E-C093-4BC6-8C39-01B3CD599F09-low.png

  • 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.

    GUID-1D9A93C2-3218-4695-B6AC-851C3CDFE216-low.png

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