Generating and building programs

Use the Generate Programs Generate toolbar button to generate test case programs for the main program, stub programs for subroutines, and stub programs for any file I/O subroutines that are discovered when the source file is parsed.

Before you begin

Optional Set-up: You can customize the set-up or tear-down test case program templates that are used for creating/modifying test case programs. Customization is necessary only if the application program under test requires special logic, such as allocating resources (memory or connections, for example) prior to a test, and releasing the resources after the test. To customize the set-up or tear-down program templates, use the Test Case Templates preferences page. For more information about customizing test case templates, see Customizing test case templates.
To enable the Generate Programs Generate toolbar button, add at least one test entry to the Test Case Editor. For instructions for adding and editing test entries, see one of these topics:

Procedure

  1. In the Test Case Editor, click Generate Programs Generate.
    1. If the source program file or any of the included files are changed while you are editing test entries, you might be prompted to update the test data layout from the source files:
      Refresh from Source prompt
    2. If you need to, you can add to or alter the data in the test entries. When your changes are complete click Generate again.
    The Generation Options window opens. This window lists subprograms and input/output files in the source file. You use this window to select the subprograms for which you want to generate stub programs and to choose the input and output files for which you want to generate programs that simulate I/O operations. For COBOL programs, the PROCEDURE DIVISION is always selected and cannot be cleared. For PL/I programs, the main procedure, Procedure, is always selected and cannot be cleared. These program divisions generate the main test case program that calls the program that is tested.
  2. Select the subprograms and input/output files to generate stub programs for.

    Select the subprograms if you want to test parameters of a sub program call. Note that you cannot compare the output of the sub program call using existing load modules.

  3. If you are generating the test case for the main program, select the Generate test case for main program check box. If you are generating the test case for a subprogram, leave the check box unchecked.
  4. Choose an option for the Generation steps.
    • If the subprogram needs to generate stub programs instead of the existing load module, choose Generate test case because you need to build stub programs manually
    • If you want to build the test case directly after the test case is generated, choose Generate and build test case.
    • If you want to run the test case directly after the test case is built, choose Generate, build, and run test case. The Run As Test Case page opens after the test case is generated and built.
  5. Click OK.
    The ZUnit framework generates the test case using the specified option without displaying confirmation windows.
  6. If the warning message There is a CALL statement whose subprogram name is not identified. is displayed, click Cancel and open the Edit Call settings dialog to view, add, edit, or remove sub program names for the dynamic call.

What to do next

If the generated test case is large, it is generated by dividing it into multiple files. When you generate this test case as a local resource, make sure to upload all of the test case files before building.

To build the test case programs later, select the source program in the Remote Systems or z/OS Projects view, and then select z/OS Automated Unit Testing Framework (ZUnit) > Build Test Case.

To run the test case later, select the test case load module in the Remote Systems or z/OS Projects view, and then select z/OS Automated Unit Testing Framework (ZUnit) > Run As Test Case.