Using Gold Input From File

    Procedure
  1. Right-click the activity from the process or subprocess and select the Add Test > Add Assertion option.
    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.

  2. Select the Activity option.

    The Gold Input From File checkbox is displayed.

  3. To provide the gold input through an XML file, select the Gold Input From File checkbox.
    The AssertType and testFilePath fields are displayed.

  4. Map the activity variable from datasource section to activityTestInput field.
  5. Browse the gold input file from the workspace and select the gold input file. This modifies the testFilePath file in XML.
  6. 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/)
  7. 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 as file:////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.
  8. To create a gold input file, run the activity for which you want to add the assertions.
  9. 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.
  10. 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.

    Note: Linearize the copied XML data if required.