Maven Sample of Unit Test Demo Project
This sample covers mocking for activities in process, subprocess, service binding, starter-end activity, and types of activity assertion.
-
Ensure that Maven is installed in your system.
-
Ensure that the Maven plugin is installed correctly in your bw studio by verifying the Maven folder present under
tibco_home\bw\6.8
directory.
- Procedure
-
In the samples directory, select AppSpace > UnitTesting and double-click UnitTestDemoProject.zip. For more information, see Accessing Samples.
-
In the Project Explorer, right-click UnitTestDemoProject.application and select Generate POM for Application. The POM Generation window is displayed.
-
Enter the Parent POM details such as Group Id, Parent Artifact Id, and so on, and click Finish.
Note: The workspace is indexed after generating the POM files for the first time and may take some time. You can continue with the following steps and allow the indexing to run in the background. -
UnitTestDemoProject.application.parent is generated and the project is converted to Maven (Eclipse project) nature.
-
Right-click UnitTestDemoProject.application.parent and select Run as > Maven test.
-
Check the console to see the result.
Understanding the Configuration
The project contains the following processes.
-
MainProcess.bwp:
This process has a timer as a starter activity, which is executed only once. Later this process makes a subprocess call to another subprocess, SubProcessWithPrimitiveAssertion.bwp.
-
SubProcessWithPrimitiveAssertion.bwp:
This process does not accept any input. First, it sends a request to a JMS destination, queue in this case, using the JMS Request Reply activity. Later, the JMS Request Reply activity body is logged and the reply message is mapped to the required format using the mapper activity. The output of the mapper is mapped with the end activity.
This process shows mocking support and Primitive Assertion in a subprocess.
-
SubProcesswithActivityAssertion.bwp:
This process accepts authorID as an input of the Start activity. The book details corresponding to the the authorID are displayed in the mapper. The GetBooks SOAP call is invoked by the author as an input. The GetBooks response is logged using the log activity.
This process shows mocking support and Activity Assertion in a subprocess.
-
JMSReceiver.bwp:
This process has a JMS Message receiver as a starter activity which gets triggered when a message is received on a queue (queue.sample). Later this process replies to the JMS message received using the Reply to JMS Message activity and then log the message.
-
SOAPService.bwp:
This process implements SOAP Getbooks by author operation, which accepts author as an input and replies the corresponding book details of that author in the response. The response is hard-coded.
Troubleshooting
If you find the application = null
error in the console then check the Maven version by navigating to Window > Preferences > Maven Defaults. The BW6 Maven Plugin Version should be the same as the plugin version you installed while installing TIBCO Business Studio for BusinessWorks. Similarly, check Maven version in the pom.xml
file.
Refer Troubleshooting guide for any issue