Running a test set

You can test programs whose WORKING-STORAGE SECTION data items affect the next test run. Tests with the same test set name are run as one test set.

About this task

By default, ZUnit initializes the WORKING-STORAGE SECTION for every test entry. When running a ZUnit test with test entries, the state of the previous test entry is left and might have an influence on the test result of the next test entry. For example, in TEST02.cbl in the below graphic, the result of the program depends on the values of the WORKING-STORAGE SECTION data items from the previous run.
Result depends on values from previous run
Note: In the AZUTSTRN test runner, by default, the WORKING-STORAGE SECTION is not initialized for each test execution, so it is affected by the value of the previous test run. However, if even one test is set to the test set name, the section is initialized every time the test is executed. Tests with the same test set name are run as a set.

The test set treats test entries as a group. ZUnit does not initialize the WORKING-STORAGE SECTION for each test. It initializes for only the first test entry in the test set.

When the test entries are imported, the test set targets a single import.

Procedure

  1. In the Test Case Editor, click the Show System Variables / Test Set button to show its menu, and click Test Set to check it. The Test Set column appears in the tests list table. You can also do this by using the right-click context menu in the editor.
    Click Show System Variables / Test Set and select Test Set
  2. In the tests list, right-click on the target test and click Edit Test Set....
    Right-click on a test and click Edit Test Set
  3. In the Edit Test Set dialog, enter the test set name in the field. The maximum length for the name is 8 characters. If the selected test entry is an imported test, several tests are shown in the Tests field. Their names also change as you change the test set name.
    Edit test set names
  4. Click OK to save the test set name.
    Note:
    • You can leave the test set name field empty. However, by doing so, the test set is not used when running the test case. Checking Test Set in Show System Variables / Test Set does not mean using the test set.
    • Imported test entries and non-imported test entries cannot have the same test set name.
    • If you delete a test member from an imported test set, it clears the test set name from all of the other test set members and you cannot set it. Therefore, you should not do it if you want to use the test set.
    • If you copy a test member from an imported test set, the test set name for the copy is empty and is not set.

Results

Executed test set are shown as TEST <test set name>. Setting a distinctive name for the test set might be helpful when reviewing the result.
Test sets in the result view