Unit Testing
Unit testing in ActiveMatrix BusinessWorks consists of verifying whether individual activities in a process are working as expected. While you can run unit tests on processes at any time during the development cycle, testing the processes before you push the application to the production environment might help you to identify issues earlier.
This section explains how to use the Maven plug-in and its features to achieve unit testing of ActiveMatrix BusinessWorks projects.
In the ActiveMatrix BusinessWorks application, the following sample projects are provided:
-
MainProcessWithUnitTestDemo.zip: Sample to show the assertion or mocking support of main processes, mocking support of process starters, and REST and SOAP service binding.
-
UnitTestDemoProject.zip: Sample to show the assertion or mocking support of subprocesses.
-
tibco.bw.UT.sample.Calculator.module.zip: Sample shows the use case of implementing unit test cases in the Shared Module of your application.
Following are the details of the processes in the sample projects:
MainProcessWithUnitTestDemo:
-
MainProcessWithProcessStarterMocked: Shows assertion support in the main process along with mocking support on the process starter.
-
RESTServicBindingeMocked: Shows mocking support on the REST Service binding.
-
SOAPServiceBindingMocked: Shows mocking support on the SOAP Service binding.
UnitTestDemoProject:
-
SubProcesswithActivityAssertion.bwp: Shows mocking support and Activity assertion in a subprocess.
-
SubProcessWithPrimitiveAssertion.bwp: Shows mocking support and Primitive assertion in a subprocess.
tibco.bw.UT.sample.Calculator.module:
-
MainProcess: This process invokes calculation operations based on input received from the HTTPReceiver. It demonstrates support for mocking the HTTPReceiver and Primitive assertion on the "cube" (a call process activity).
In the Shared Module, you can perform the following processes:
-
Addition: This process provides inputs (number 2 and number 3) for addition and verifies the result of the "end" activity using a primitive assertion.
-
Cube: This process provides input (number 8) for the cube operation and verifies the result of the "end" activity using an activity assertion.
-
Multiply: This process provides inputs (number 2 and number 3) using an "input XML file" for multiplication and verifies the result of the "end" activity using an activity assertion with a reference to a gold input file on the "end" activity.
-
Square: This process provides input (number 2) using an "input XML file" for squaring and verifies the result of the "end" activity using a primitive assertion.
-