Save Result as Validation
We now have a test scenario that calls two programs in a sequence and uses an output field from the first call as input to the next. However, the result will always be successful as long as the programs respond. We still need to setup verification of the result data. We can do this in three ways:
- Use a Verify element from the tool palette. This element compares the value of a single field with an expected outcome.
- Enter expected values or verify expressions next to the field input values for each component call.
- Save the complete result as validation data for future executions. All fields from program responses will be compared to the saved data
We already saw how to use the second approach when working with the web client. Now we will use the third approach as it is quick to setup and is really useful for legacy systems that are already working. In the execution result editor there is a Save as validation button in the top right corner. It will take a copy of the result data and save it in a validation file in the same directory and with same name as the test scenario file. At next execution the execution result will be compared against the validation data, and the result will show red if there are differences in component outputs. The validation file can be opened and fields can be excluded from the validation. This is needed for certain type of fields such as the timestamp and date fields in the XAPGMTST program. These fields will be different at each call and we would always get a red status.
Do the following to create and edit a validation file:
- Click the Save as validation button at the top right corner in the result editor.
- Switch to the Test Scenario editor and click
Execute. Click OK when the Execution Context dialog appears. It has remembered the data from last execution. - Inspect the result when the execution has finished and notice that the result is blue. There should be four failures; the xacurrenttime for the first and second call and the minutes and seconds fields for the second call. Select an item in the Failed section at the top and the differences will show below in the Test Scenario Results.

- Open the TestScenario.validation validation file and select the components to the left (just select them - check the box by them). Select all timestamp based fields to be excluded.
- Set a checkmark at the xacurrentdate and xacurrenttime fields for both components and in XAPGMCAL set a checkmark at the xaminutestomidnight and xasecondstomidnight fields. Save the changes. This will exclude the fields from any call to the module in the script.
- Save the changes to the validation file.
- The Test Scenario Validation Results section on the right contains the actual order that the components were run in and the actual values returned. When components run multiple times, they will be listed here in the execution order.
- Switch to the Test Scenario editor and execute the script again. Now you should see a green result.
- Switch to the Compare Text tab and see that there are still differences, but that they are now ignored.