Adding Mocking Support for Activities

This document provides steps for adding mocking support for BW activities in TIBCO BusinessWorks™ Container Edition with the Maven Plugin. User can skip execution of activity (usually activities that are based on external service) whose process is under Unit Testing. Mocking support functionality is required mainly for the TIBCO BusinessWorks Container Edition activities that are based or dependent on some external Cloud Service or Database systems which are eventually under Unit Testing. To execute Unit Testing successfully on processes that contain the TIBCO BusinessWorks Container Edition activities, we need to mock the TIBCO BusinessWorks Container Edition activities. Now a dummy output can be added to mock activities that can be used in Unit testing for successful execution. Currently, Mocking Feature doesn't support the main process - they only mock the activities from sub-processes.

Prerequisites

Adding Mock Output to an Activity

Make sure the demo project with the subprocess that has the activities to be mocked is created.

To add mock output to an activity in TIBCO BusinessWorks™ Container Edition, follow these steps:

Procedure

  1. Right-click on module project and select New > Tests Folder.
    This will add the Tests folder in the module project.
  2. In Project Explorer, right-click on the Tests folder and choose New > Add Test File. If needed, change the name of the Test File and Click Next. This displays the wizard with a list of sub-processes. Select the subprocess having the activities to be mocked.

  3. Right-click on the activity to mock and select the Add Mock To Activity option.
  4. The new Tests tab is added in the property section of the activity. The new Tests tab has file selector to select the Output File. Select the output file using File Selector.
  5. In the Mock Output File field, provide the relative mock output file.
    The mock output file should be present in the Tests folder of the project. The relative path will have the value like "Tests/fileName.xml". It is mandatory to provide the Tests folder name also in relative path.