Recording test case data for batch programs

Use the Record Data window to record test case data for a batch program and import it into the Test Case Editor.

Before you begin

To create/modify a test case for a batch program, set property group options in the property group that is associated with the source program for which you are generating the test case. Then, use the Create/modify Test Case action to create and edit the test case.

For more information about setting preferences and property group options for Dynamic Test Runner, see Preference and property group settings for Dynamic Test Runner. For recording batch programs, the Dynamic Test Runner libraries settings on the Preferences page are required. For recording file I/O programs, the Capture file I/O transaction settings on the Preferences page are required.

You can use this procedure to record data for local or remote batch, batch/Db2®, and file I/O QSAM and VSAM programs. For either source location, you need a connection to a remote system. While recording data for batch applications, the ZUnit (z/OS® Automated Unit Testing Framework) submits JCL to the remote system to execute the application and capture data. A remote connection is required even when the source files are located on a local workstation.

About this task

The procedure for recording test data for a batch program involves two JCL files:
  • The JCL that runs the batch application to be recorded. This file is referred to as the JCL file in the Record data for test case window.
  • A temporary interim JCL file that contains the contents of the JCL file with recording parameters added to it. You can view, edit, and save this interim file before recording data. This file is referred to as the recording JCL in the procedure steps.

    If the JCL file specified in the JCL file field already contains recording parameters, they are validated and updated before the recording job is submitted.

Procedure

To record and import data for a batch program into the Test Case Editor by using the Record Data window:

Important: For file I/O programs: Check the Capture file I/O transaction settings on the Preferences page. Specify the required source location for capturing file I/O transactions (customized LLEP) on the Batch Recording Service preference page.

  1. Open the Test Case Editor on a batch program.
    For more information about opening the Test Case Editor, see Creating/modifying a test case. While recording test case data, the Test Case Editor must remain open. If the editor is closed, a warning message window opens and the recording is canceled immediately.
  2. To open the Start recording data window, click the Start recording data button Start recording data button on the main toolbar.
    For local source files: To record test data for a local source file, you must select a remote system connection for running the batch application.
  3. In the JCL file field, select a file from the list or click Browse to navigate to the file that contains the JCL that runs the batch application.
    You can use the Show files with *.jcl extension only check box to filter when browsing for the JCL.
  4. Conditional: Select the Add or overwrite existing recording parameters check box to add or overwrite existing recording parameters. This is required if the JCL does not have recording parameters.
  5. In the Playback file field, specify a sequential data set name for the playback file. You can select an existing file or create a file.
    The playback file is stored in a sequential data set. The default data set name is <HLQ>.ZUNIT.PB.programName. In this file name, <HLQ> is replaced by your user ID and programName is the name of the program on which you opened the Test Case Editor, that is, the program under test. You can specify a different data set name on the Playback File preference page.
  6. In the Record data for test case window, in the Main load module / Run unit field, specify the name of the main load module where an application starts. The default value is the PROGRAM-ID from the COBOL source file. In the Module under test field, specify the name of the load module that is the target of the recording. The default value is the PROGRAM-ID from the COBOL source file.
  7. You can choose to edit the recording JCL or skip editing JCL:
    • To Edit JCL: To view or edit the JCL before submitting it for recording:
      1. Click the Open JCL link. ZUnit opens the recording JCL in the JCL Editor.
      2. Edit and save the recording JCL as a data set member (for remote source) or a local file (for local source).
      3. Click the Start recording data button Start recording data button on the main toolbar again
      4. Click Yes to resume the recording process, or No to cancel. If you click No, you cannot resume the recording and importing operation. To reuse the edited recording JCL file, select it on the Record data for test case window, and then click Record Job.
    • To Skip Editing JCL: If you do not need to view or edit the recording JCL, click Record Job on the Record data for test case window.
    ZUnit submits the recording JCL and listens for the job to complete. It opens the Job Submission window to display the name of the remote system and the Job ID, and to prompt you with job monitoring options:
    Job Submission window
  8. Select a job monitoring option or click OK to skip job monitoring.
    ZUnit returns control to the Record data for test case window and displays the recording status on the window. When the recording job completes, ZUnit opens a window prompting you to import the recorded data.
  9. Click Yes to import the data into the Test Case Editor or No to cancel the recording and importing process.
    Note: For file I/O programs:
    • When the Generate (Generate the test case programs) button is selected in Test Case Editor, a warning dialog displays if the program under the test has file I/O, Dynamic Test Runner (BZUPLAY) is selected in Preferences, and Capture file I/O is enabled, but there is a test that is not relevant to the recording. Record the test data and delete the tests that are irrelevant to the recording. If you want to run tests without recording, run them without turning on the capturing of file I/O transactions.
    • The recorded data of these file I/O statements: OPEN, CLOSE, START and DELETE, are not shown in the Test Case Editor.
    • After importing file I/O program transaction data, you cannot add, insert, or delete records in the Test Case Editor.

Results

The recorded data is imported into the Test Case Editor. A message window opens and lists the test entries that are created by importing the data. If an error occurs in the stop recording operation, an error message might be shown in the status line of the window.

What to do next

You can use the Test Case Editor to edit the data and generate the test case program. The captured record should be used as-is. Delete the test that is irrelevant with playback file before generating the test case program on file I/O capture mode.

For more information about using the Test Case Editor, see the related topics.