Running a test case with debugging

Use the z/OS Automated Unit Testing Framework (ZUnit) > Debug action to run a test case with debugging.

Before you begin

Running a test case with debugging or with code coverage requires that the STEPLIB DD statement in the AZUZUNIT procedure include SFELAUTH, and that the AZUZUNIT procedure be up-to-date for version 14.0 of the product.

To start debugger session at the test target source with delay debug, the EQAOPTS load module should be built and located in system search path. For details, see xUnit support for Enterprise COBOL and PL/I.

You must generate and build a test case from the source file. For instructions for generating and building a test case, see these topics:

ZUnit uses the IBM® z/OS Debugger to debug a test case. To prepare a program for debugging, you must build it with certain compiler options. For more information about preparing to use the debugger, see Preparing to debug. For more information about the runtime debug options, see the related topics.

Procedure

  1. For remote resources: In the z/OS Projects or Remote Systems view, select a COBOL or PL/I source file or load module. For local resources: In the Remote Systems view, select a local Enterprise COBOL or Enterprise PL/I source file.
  2. Right-click and select z/OS Automated Unit Testing Framework (ZUnit) > Debug Test Case.
    The Debug Test Case window opens. This window verifies the location of the test runner configuration file and the test runner result file. For local resource: the Select Test Case dialog opens. Specify the uploaded ZUnit test case source or uploaded ZUnit test case module in the dialog, and click OK.

    The Debug Test Case window opens. This window verifies the location of the test runner configuration file and the test runner result file.

  3. Specify the file or member names for the configuration and result files. If you choose an overwrite option for the configuration, or the member does not exist in the data set, the configuration will be generated. If the member exists in the data set, it will be reused. Choose an overwrite option for the generated runner result.
  4. Check the Update Delay Debug Profile option, and ZUnit will update the debug profile (<user>.ZUNIT.DLAYDBG.EQAUOPTS) for each test case debug so that the debugger session start at the target source. ZUnit updates just the one for the application.
  5. Click OK.
    The debugger starts and the Debug perspective opens on the source file.

Results

The following example shows the Debug perspective for a ZUnit test case. Breakpoints are automatically set to stop at all entries. You can reach the entry point of the source file by repeatedly clicking resume.
Debug perspective for a ZUnit test case
Debug perspective for a ZUnit test case
Tip: If the Debug perspective displays data for Assembler only or displays no data, right-click the BreakPoint view and select Add breakpoint > Stop At All Function Entries, and then select Resume. By repeating resume, you can see the COBOL or PLI source listing. After you do this action once, the data displays correctly for subsequent debug operations.