Record and import data into the AZUTC006.cbl test case

In the Test Case Editor, you can record data from a CICS application running in CICS, and import the data into a test case, and then generate, build, and run the AZUTC006.cbl test case outside of CICS to see the test results for the imported data.

Recording and importing data

Before you begin

This procedure uses a sample program included with IBM® Developer for z/OS®. It also uses a z/OS project that was created by the sample setup procedure. Before using this procedure:
  1. Set up the sample files by using the instructions in Setup instructions.
  2. Create/modify a test case for the sample file by using the instructions in Create/modify a test case from EPSCMORT.cbl.

Procedure

  1. On the main toolbar, click the Record DataRecord Data button.
    Record Data button
    The Record data for the test case window opens.
    Record data for the test case window
  2. Select the URL that you set on the CICS Recording Service preference page, or type the URL that you want to use for the recorder.
    The format of the URL is http://hostNameOrIPAddress:portNumber/zunit:
    • portNumber is the port number defined in the tcpipservice AZUREST. You can obtain this information from CICS region system administrator or use the command cemt inq tcpipservice and look for the port number for the AZUREST definition. For more information about configuring a CICS region for ZUnit, see Support for CICS applications in the z/OS Dynamic Test Runner Configuration Guide.
    If the URL needs credentials for access, you must specify the URL with your credentials on the CICS Recording Service preference page.
  3. Click Start recording.
    The You are now recording message displays in the window.
    Data recording in progress
    Note: You can close this window during the recording. To re-open it, click the Record DataRecord Data button on the main toolbar.
  4. Start transaction EPSP.
    The terminal shows the screen and prompts you for input.
  5. Enter the following values for the sample:
    • Amount of Loan: 20000000
    • Length of Loan in Years: 10
    • Interest Rate: 2.5
    Input values for the calculator
  6. Press Enter.
    The calculated Monthly Payment from the transaction is displayed in the terminal.
    Calculated result in the terminal
  7. Press F3 to end the transaction.
    Transaction ends
  8. In the Record data for the test case window, click Stop recording.
  9. In the Export Playback File window, click Create, and then click Import All.
    The recorded data for the three conversations are imported as three tests (TEST2, TEST3, and TEST4). A message pop-up is displayed. Click OK to close the message.
    Message of test data imported as tests
  10. In the Tests list, select TEST3, and then, in the Layouts view, double-click EXEC CICS RECEIVE MAP.
    The values you entered are shown as Input to the parameters of the INTO option:
    • EPLOANI: F2F0F0F0F0F0F04040404040 (hexadecimal data type)
    • EPYEARSI: 10
    Viewing imported test data
  11. Select TEST4, and double-click EXEC CICS SEND TEXT.
    The following values are shown as Expected output to the parameter of the FROM option:
    • END-OF-TRANS-MSG : END OF TRANSACTION – THANK YOU
  12. Generate the test case program.
    1. Click Generate.
      Click the Next button
      The Test Case Editor prompts you to save your changes.
    2. Click Yes.
      The Generate test case programs window opens. You can see the list of the test case and stub programs that ZUnit generates from the source program.
    3. Deselect the EPSNBRL subprogram. Leave the Generate test case for main program box unchecked. Select the Generate test case radio button.
      Generation Programs window
    4. Click OK.
      ZUnit generates the test case and stub programs to simulate CICS calls.
  13. Build and run the test case program.
    1. In the z/OS Projects view, expand ZUnit Enterprise COBOL test data samples > sample > <HLQ>.ZUNIT.COBOL.
    2. Right-click on the EPSCMORT.cbl source file, and select z/OS Automated Unit Testing Framework (ZUnit) > Build Test Case.
      ZUnit generates a JCL and submits a job to build the test case, and then prompts you to run the test case.
    3. Click Yes.
      The Test Case window opens.
    4. Select the Overwrite member check box for both the runner configuration file and the runner result file.
    5. Click OK.

Results

The ZUnit test runner starts and runs TEST2, TEST3, and TEST4. When it completes, the ZUnit Runner Results view opens and shows that all three tests passed the run.
Tests passed