Steps to Add Mock Input - SujataDarekar/bw6-plugin-maven GitHub Wiki


Mock Input Support to Process Starter

Introduction

This document explains the steps for adding the Mock Input to the Process Starter with BusinessWorks 6.8.0 with the Maven Plugin 2.9.0. User will skip the execution by adding the mock input to the Event Source whose process is under Unit Testing. Assertion support will not be provided to the Event Source because Event Source creates BW Jobs continuously and also they are depend on third Party . Unit Testing is specific with a single job only So there is no point or use case to add the Assertions to the Event Source. Hence we are only providing Mock Input support to the Event Source.

When User wants to test the activities from Main Process, it is recommended to Mock the Input of Process Starter.

Pre-requisites

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

• BusinessWorks Maven Plugin with version 2.9.0 should be installed. Please download the BW6-Maven-Plugin 2.9.0 from here: https://github.com/TIBCOSoftware/bw6-plugin-maven/releases

• Process Starter to be mocked should be present in Process which is under Unit testing.

• Generate valid Mock Input XML file. Please refer to the Mock Input File Generation section to generate the Mock Input file.

Adding Mock Input to Process Starter

This section assumes that you have already created the demo project which has the Process Starter to be mocked.

  1. Right-click on module project and select New->Tests Folder. This will add the "Tests" folder in the module project.

images/image1.jpg

  1. Right-click on the Tests folder in Project Explorer and choose New -> Add Test File. Change the Test File name if needed and hit Next which will show the wizard with a list of Processes. Select the process having the Process Starter to be mocked.

images/MainProcessSupport.jpg

  1. Right-click on the Process Starter to mock and select an option "Add Input".

images/AddInput1.jpg

  1. New "Tests " tab will be added in property section of activity which will have the "Input XML File" option to select the path of mock Input xml file

images/TestNew.JPG

Steps to Generate the Mock Input File

  1. Run the application in debug mode from the Business studio.
  2. Select the "Output" tab from the Job Data for Process Starter for which we need to generate the mock input file
  3. Right click on the activity Name in Output tab and copy the data by selecting the option "Copy Variables"

images/copyValues.jpg

  1. Paste the copied data into the XML file

images/MockInputFile.jpg