Skip to content

Running Asssertions Using Activity Mode with GoldInputFile

Sujata edited this page May 26, 2020 · 9 revisions

Running "Activity" Assertions using "Gold Input From File" in BusinessWorks

Introduction

This document provides instructions to run Activity Assertions by proving the gold input data from input xml file in BusinessWorks 6.6.0 HF-01 with BW Maven Plugin 2.5.0. The Activity Assertion feature provides the capability to test complete activity output.

Pre-requisites

• BW 6.6.0 HF-01

• Maven: https://maven.apache.org/download.cgi

• BusinessWorks Maven Plugin 2.5.0 – https://github.com/TIBCOSoftware/bw6-plugin-maven/releases

Adding Activity Assertions with "Gold Input From File"

This section assumes you have already added the "Test" file for the sub-process which you want to test. Please refer "Adding Unit Tests Assertions" section from https://github.com/TIBCOSoftware/bw6-plugin-maven/wiki/UnitTesting to add test file.

  1. Right click on the Activity from the subprocess and Click on "Add Test -> Add Assertion" option. This will add the "Test" tab

  2. Open the "Tests" tab. You will see Assertion Mode drop down which will have the "Primitive" and "Activity" mode options. Using "Primitive" mode user can test only the Primitive type elements.To add primitive mode please refer https://github.com/TIBCOSoftware/bw6-plugin-maven/wiki/UnitTesting. Using "Activity" mode User will be able to test the complete activity output which could be a complex schema.

  1. Select "Activity" option from "Assertion Mode" drop down, you will see the "Gold Input From File" option as shown in below image. When user wants to provide the gold values using xml files they can select the checkbox "Gold Input From File" else they can provide the gold values directly using the UI with editable values mentioned in wiki https://github.com/SujataDarekar/bw6-plugin-maven/wiki/Running-Asssertions-Using-Activity-Mode

  1. To provide the gold output through xml file, select the checkbox "Gold Input From File".Now as shown in below image you can see the "activityTestInput" and "testFilePath" fileds. Map Activity variable from "datasource" section (In Image you can see it's Mapper) to "activityTestInput" field. In "testFilePath" field, use the doc function from the URI function and provide the input file path in the format 'file:///inputFilepath'(In image the value of testFilePath is doc('file:///C:/Tests/UnitTestingsComplex.xml')). In the case of Unix systems, please provide the absolute path preceding the extra forward slash. Example: doc('file:////home/Test/Mock_files/Activity_Assetion_IP_File.xml')

  1. Now the user can provide the relative Gold Input file path in "Gold Input From File" field. User need to keep gold input file in "Tests" folder of the BW project. User can create separate folder for gold input files under "Tests" folder. The relative path will have the value like doc('file:///Tests/UnitTestingsComplex.xml'). It's mandatory to provide the "Tests" folder name also in relative path. In case of Unix please provide the relative path like below: :- ('file:///Tests/Mock_files/Activity_Assetion_IP_File.xml')

    Note: This feature will be available with BW Maven Plugin 2.5.0

  2. To create gold input file, Run the activity for which you need to add the assertions. Copy the input JOB data from debug console using the "copy values" option and paste in xml file. Linearize the copied xml data.Change the input value with gold input values.

Note: It's mandatory to linearize the copied xml data.

  1. To run the test case please refer "Running the Unit Tests in Business Studio" from https://github.com/TIBCOSoftware/bw6-plugin-maven/wiki/UnitTesting
Clone this wiki locally