Using Gold Input From File
- Procedure
- Right-click the activity from the process or subprocess and select the
The Test tab is added.
The Assertion Mode dropdown list has two options: Primitive and Activity.
Use the Primitive option to test only the primitive type elements.
Use the Activity option to test the complete activity output that can contain a complex schema.
option.
- Select the Activity option.
The Gold Input From File checkbox is displayed.
- To provide the gold input through an XML file, select the
Gold Input From File checkbox.
The AssertType and testFilePath fields are displayed.
- Map the activity variable from datasource section to activityTestInput field.
- Browse the gold input file from the workspace and select the gold input file. This modifies the testFilePath file in XML.
- Alternatively, in the
testFilePath field, use the doc function from the URI function and provide the input file path in the format
file:///inputFilepath
. In the case of Unix systems, please provide the absolute path preceding with an extra forward slash.Example: doc(file:////home/Test/Mock_files/
) - Provide the relative gold input file path in the
testFilePath field.
You can create a separate folder for gold input files under the "Tests" folder. The relative path has a value like doc
file:///Tests/UnitTestingsComplex.xml
. It is mandatory to provide the Tests folder name also in the relative path. In case of Unix, provide the relative path asfile:////Tests/Mock_files/Activity_Assetion_IP_File.xml
.Note: This feature is available with TIBCO ActiveMatrix BusinessWorks™ Maven Plug-in 2.5.0 and above. - To create a gold input file, run the activity for which you want to add the assertions.
- Observe the Tests tab > Data Source section schema. Right-click the activity name on the Debug console and select Generate Gold Input File either from the Input job data or Output job data.
This opens a dialog where you can select a folder in which the Gold input file is to be created. In the File Name field, you can specify the name of the Gold input file to be generated.