Adding a test to a test case
After the z/OS® Automated Unit Testing Framework (ZUnit) test case wizard generates a test case template, you add tests to it by editing the file and adding code that calls the program under test, makes API calls to run the tests, and returns the test results to the test runner.
Before you begin
- Create a test case template by using the New COBOL z/OS Automated Unit Testing Framework (ZUnit) Test Case Template wizard or the New PL/I z/OS Automated Unit Testing Framework (ZUnit) Test Case Template wizard.
- Open the test case file in an editor.
About this task
*+---------------------------------------------------------------+
*| TEST001 |
*| A Test (supply more detail). |
*| |
*| @param TEST-CASE-PTR (input), |
*| A pointer-by-value to an area maintained by the |
*| ZUnit Test Runner that identifies the Test Case |
*| and associated resources. |
*| |
*| @param TEST-FIXTURE-PTR (input), |
*| A pointer-by-value to a user-defined structure, |
*| established previously in the setup procedure, that |
*| represents the Test Fixture. |
*| |
*| @param TEST-NAME-PTR (input), |
*| A pointer-by-value to an area containing the name |
*| of the Test for which a Test Fixture should be |
*| allocated. |
*| |
*| @param TEST-NAME-LEN (input), |
*| A integer-by-value that specifies the length in |
*| bytes of the value contained in parameter |
*| TEST-NAME-PTR. |
*+---------------------------------------------------------------+
IDENTIFICATION DIVISION.
PROGRAM-ID. 'TEST001'.
DATA DIVISION.
WORKING-STORAGE SECTION.
1 FAIL-MESSAGE-TXT PIC X(254).
1 FAIL-MESSAGE-LEN PIC S9(9) COMP-5.
LINKAGE SECTION.
1 TEST-CASE-PTR POINTER.
1 TEST-FIXTURE-PTR POINTER.
1 TEST-NAME-PTR POINTER.
1 TEST-NAME-LEN PIC S9(9) COMP-5.
1 TEST-NAME PIC X(254).
PROCEDURE DIVISION USING BY VALUE TEST-CASE-PTR
BY VALUE TEST-FIXTURE-PTR
BY VALUE TEST-NAME-PTR
BY VALUE TEST-NAME-LEN.
SET ADDRESS OF TEST-NAME TO TEST-NAME-PTR
* TODO: Modify Test program 'TEST001' until it passes.
DISPLAY 'TEST001(' TEST-NAME(1:TEST-NAME-LEN) ')'
CALL 'AZUASTFA' USING BY VALUE TEST-CASE-PTR
.
END PROGRAM 'TEST001'.
Procedure
To create a test, modify the following sections of this subprogram.