Saturday, August 23, 2014

Creating and Executing Test Cases for BPM Processes


(JDeveloper 12.1.3 / WLS 12.1.3 / SOA/BPM Suite 12.1.3)
  
In this post I will show how to create and execute Test Cases for BPM Processes.
I will be using the same project which I used to show how to define Business Rules in BPM.
http://sameerdarbha.blogspot.com/2013/07/implementing-business-rules-in-bpm.html
The above project was created in 11.1.1.7 version of BPM.

For this post, I will be using JDeveloper/BPM Suite/WLS 12.1.3.
I have migrated the application ‘EmployeeTravelExpenseSystem’ to 12.1.3.

And I modified the process a little bit to add another Start activity of type ‘Message’ so that we can start and test this process from EM console. It takes the input as the same object ‘TravelExpenseObject’ as shown below.


Right click on ‘SOA > testsuites’ to create a Test Suite as shown below and give a name to the Test Suite.



Right click on the Test Suite ‘ETEAPTestSuite’ and create a Test case ‘AutoApprovalTestCase’


Click ‘Generate Sample’ button to generate the input XML and enter the parameters satisfying the Auto approval case according to the Business rules. (Check the previous post to check the conditions).


A new file ‘AutoApprovalTestCase.xml’ file will be created as shown below which looks like the composite.xml


Create another test ‘RequiredApprovalTestCase’ with the input xml as follows satisfying the Required  Approval case according to the Business rules.


We can run the individual Test cases or even the complete Test Suite from within JDeveloper.
Right click the Test Suite name and select ‘Run Test Suite’.



JDeveloper will ask for the server name to which this application has to be deployed. Enter the name of the server.


 Enter the test case execution name and select the test cases you want to run.


 A new file will be opened showing the test results of the Test Case execution.


Also these test case execution results can be seen in the EM console.
This application is deployed to a 'Compact Domain' in the WLS.


Optionally the test cases also can be run on the EM console, since the test cases are deployed along with the application.



When the Test Suite is run, 1 instance of the process for each test case is created.
The instances created by the Automated Test Cases like this will be shown with a yellow 'dot'.
The Test case for Auto approval process flow is as follows.


The test case for Approval required process flow is as follows.