Steps to Add Mock Input to the Operation from SOAP REST - SujataDarekar/bw6-plugin-maven GitHub Wiki


Mock Input Support to the Operation from SOAP/REST

Introduction

This document explains the steps for adding the Mock Input to the Operation from SOAP/REST Service with BusinessWorks 6.8.0 with the Maven Plugin 2.9.0. When user want to test the activities from SOAP/REST service process then they need to mock the REST or SOAP service operation. In order to mock Service Binding User need to mock the respective operation. Once User mocked the respective operation, corresponding JOB flow will get executed with mock input while running the test case. If Service has multiple operation then for each operation user will create test file and will add mock input accordingly to test the each flow associated with Operation

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 Service Operation

This section assumes that you have already created the demo project which has the Service 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 Service to be mocked.

images/AddTestFile.jpg

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

images/AddInput.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/TestTab.jpg

Steps to Generate the Mock Input File

  1. Run the application in debug mode from the Business studio.

  2. Right click on "All" tab from the Job Data for "OnMessageStart" and select option "Select All" images/SelectAll.jpg

  3. Select "Copy Variables" option after "Select All" option.

images/CopyVariables.jpg

  1. Paste the copied data into the XML file

images/mockFile.jpg