Adding Mock Support for Activities

This section provides steps for adding mocking support for TIBCO BusinessWorks Container Edition activities with TIBCO ActiveMatrix BusinessWorks™ Plug-in for Maven. You can skip execution of an 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 run 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. The mocking support can be used to mock the activities from processes or sub-processes.

Adding Mock Output to an Activity

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

    Procedure
  1. Right-click on the module project and select New > Tests Folder.
    The Tests folder is added 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. Click Next.

    The New Test File wizard is displayed with a list of processes and subprocesses.

  3. Select the process or subprocess having the activities to be mocked.
  4. Right-click on the activity to mock and select the Add Mock To Activity option.

    The new Tests tab is added in the property section of the activity.

  5. The new Tests tab has a file selector to select the output file. Select the output file using File Selector.

  6. In the Mock Output File field, browse and select the file from the workspace. The path of the Mock output file can also be set using Module properties.