Functional Test Component
A Functional Test Component represents a call to a load module and is the most important test scenario element. The load module can be written in any language, for example, COBOL, PL/I and Assembler.
It can be added to the test scenario from the tool palette or by dragging a specific component from the repository.
The Component element specifies the name and type of the component as well as the concrete data for the call. The Test Scenario graphical editor automatically builds the Source tab statements.
The user interface for the component lets you specify all the data in an easy way. The Element properties section for the Functional Test Component includes a tab for each logical data that can be specified, i.e. Input/Output Data, Properties, Stubs, Data sets (ddname substitutions, data sets to compare and data sets to delete), and Setup JCL.
When adding the Functional Test element to the Test Scenario by dragging it from the tool palette, the Select a Component popup displays. Here are the fields available when setting up this element:
- Empty box showing Enter a filter - attribute where you enter the Name of the component from the Repository you want to use. As you type in a value, it will automatically show you matches.
- Use environment filter checkbox- attribute that refines the matches list to only include the Environment selected.
- Use Tag Filter checkbox - attribute that refines the matches list to only include the components with a particular Tag.
Components in the repository can have a Tag added in the General Information section of the component. A tag is a way to group components that are related. An example of a Tag would be for components related to a topic or project.
- OK / Cancel - Click OK to save your element.
Input/Output Data tab
The Input/output Data attribute displays all the input and output fields from the components linkage section. This will show the field Name and the complete Parent path to get to the field, the Value that can be entered, the Expected Value, the Verify Expression and the Hexed to show if hex is being used.
Properties tab
The Properties tab will allow for unique settings to be set at the Element level. Provide the properties information with the following fields and option:
- ID - is a unique name used to refer to output from this element to other elements in this Test Scenario. Reference to this ID by using the format ${myid}.
This can be used to reference a JobDefinition from the repository. After a Component has been executed the ID will contain the ID of the job executed at the host. The ID is used by the Read Spool File element to retrieve a spool file from the job.
- Label - a label to help identify the component.
- Description - an optional description of the Test Element.
- Program name - component program name.
- Job name - optional Job Name attribute is used to specify the name of the job that is executed at the host.
- Verify program exit code - attribute specifies an expression to be used to verify the program exit code after the execution. By default, it is set to value <8 which means that if the program exit code is less than 8, then the test scenario will not fail. This can be changed to other expressions like, for example, 2<value<6.
After a Component has been executed, the Source tab of the Execution Results (.result) includes parameter programexit with the exit code returned by the program. The programexit value can be verified with an expression in a Verify element.
Perform a rollback after execution - check this option if Non-virtualized Test should perform a rollback after executing the program. This is only relevant for updating Db2 programs.
- Use Post SQL Select - check this option if a SQL select statement is to be executed after the component has been executed but before an optional rollback is made. This inline SQL Select element is only relevant to use when testing and updating a Db2 program where the Perform a rollback after execution attribute is checked. In this case, we will be able to select data from Db2 before the rollback and in the test scenario verify if the update was as expected - even though the transaction has been rolled back.
When this option is selected, a SQL Select element will be added into the Functional Test component. Select this SQL Select element and supply the necessary values. For details, see SQL-Select.
- Stop execution on assertion failures - check this option if the test scenario execution should stop when an output fields value is verified to be wrong.
- Expect an abend, i.e. fail the test if the program does not abend - check this option if you expect the program to abend. The test scenario will fail if the program does not abend.
Stubs tab
The Stubs tab will allow for unique settings to be set at the Element level.
- Contains static linked submodule - use this checkbox attribute only when one or more submodules to the component should be stubbed/virtualized with stub data. The calltype attribute must be static if one of the sub modules is statically bound to the module. A Stub is either specified by a path or an ID attribute. The File path attribute points to an XML file with stub data and the Repository ID attribute refers to a Stub in the repository.
- Drag_drop stub files below to add sub module stubs - stubs can be added to the Component through the UI editor by drag and drop of a stub file (.xastub) onto the Stubs table, and through drag and drop of a Stub from the repository to the table.
Datasets tab
The Datasets contains three sections to specify data set needs.
- Enter DD names that should get values replaced in execution - this attribute is optional and should not be used together with the Setup element. It is used for dynamically changing the JCL specified for the component in the repository. The element can contain a number of elements that each specify a DD name that should point to a Dataset name. At execution time, the JCL will be changed so the DD name in the JCL will refer to the data set name specified.
It is possible to use variable substitution in the in the DD name, Dataset name fields on this tab. Hence, parts of the JCL can be parameterized into Variable items and external property files. At runtime, the reference will be substituted with the value that is referenced. For details on how to set up a variable, see the Variable element . - Enter names of output data sets that should be compared to expected data sets - this attribute is optional. You can use it to setup a comparison of an actual output data set produced by the program and an expected data set after the execution.
When Add is selected, a Verify Dataset element will be added into the Functional Test component. Select this Verify Dataset element and supply the necessary values. After saving this information, the data set names will appear in the Datasets tab. For details, see Verify Dataset.
Having the Verify Dataset occur within the component is important when updating Db2 files because the component is not complete until all elements within it are complete. If differences are detected during the Verify Dataset the rollback after execution can still occur for the component changes that aren't yet committed.
- Output data sets to initially delete, before executing the component - this attribute is optional. Add specific data set names to the list that will be deleted before the JCL runs.
Setup JCL tab
The Setup JCL attribute is optional and should only be used when it is needed to specify custom JCL for the specific execution.
- Only use this JCL checkbox - attribute specifies if the JCL should override the JCL specified for the component in the repository. If checked (true), only the JCL specified will be used. Otherwise, it will be appended after the JCL specified for the Component in the repository..
- Execute step with reference to Job Definition - this attribute may contain a reusable JCL snippet. It is possible to use drag and drop of a job definition from the repository.
- Execute step Raw JCL - this attribute adds this JCL into the step where the component is being executed.
- Pre step raw JCL - this attribute contains optional JCL needed for a separate step in the JCL before the step executing the component. This step can refer to JCLLIBS that will automatically be added to the top of the generated JCL.