Friday, October 17, 2014

Human Task Assignees


(JDeveloper 12.1.3, WLS 12.1.3, SOA/BPM Suite 12.1.3)

In this blog, I will show some of many possible ways to assign a Human Task to one or more Assignees and observe their behavior.

If a task has to be assigned to more than one user, the simplest way is to assign it to a Group, but only if all the users are in that Group. But if there are some users in the group which the task should not be assigned to, or not all the users are present in the group, then assigning the task to a Group may not work exactly how we want it to.

In such cases we can set the assignees to a task in any of the following ways.

1.      Separate Parallel Participants within same Stage


We can modify the Human Task Assignees to add a new Participant as shown below. In this example, I will set the first participant to be derived from the Swimlane. (User is assigned in Organization file)


And the second participant to be derived from the payload.


Both the above assignees are defined in the same stage, so considered to be Parallel. That means the task will be assigned to both the assignees at the same time.


When one of the assignees responds to the task, the task is still assigned to the second user and is not automatically completed. 


The second user also has to complete the task, only then the whole human task is set to completed status. After the second user completes the task, below is the human task status.


Note that the ‘Voting’ concept is not applicable here since the task assignee Type is still ‘Single’. So the human task is not completed until all the assignees complete their tasks. (Voting is applicable when the Assignee Type is ‘Parallel’)

Also, Note that ‘Claim’ also will not be applicable here. Even if the first user Claims the task, the second user also have to submit the task. Until then, the human task is not set to completed status. (Claim is applicable when assigned to a Group or a comma separated users)

2.      Separate Serial Participants within same Stage

For this I will just change the participants sequence as shown below.



In this case when the task is created, the task will be first assigned to the Participant1.
Only when first participant submits, the task will be then assigned to the Participant2.
Only when all the assignees in the chain submit their tasks, the human task is set to completed status.

3.      Task Assignee Participant Type : Parallel

For this I will change the Participant type to ‘Parallel’ and get both the assignees from the Payload.
In this, the task will be assigned to all the assignees at the same time.


For Parallel type of assignee, we can specify the task completion condition by vote percentage in the Voting tab.
Following condition means that if 50% of the assignees vote, irrespective of the outcome, the human task is said to be completed.



For example, if we set the following condition, and both the assignees select REJECT action, then the default outcome SUBMIT will be applied to the human task.


Note that the ‘Claim’ option is not available for the assignee in this case.

4.      Task Assignee Participant Type : Serial

Works similar to 2. (Separate Serial Participants within same Stage)


5.      Comma Separated Users

For this I will set the participant from only one payload attribute, but pass a comma separated assignee name value to it while calling the process.

In this case also, the task is assigned to both the users at the same time.
Note that the Claim option is available to the users in this case.
When one user ‘Claims’ the task, the other user will only be able to see the task in his queue but will not be able to perform any actions on the task.

When any one of the users submits the task, the human task is completed and is removed from the other users Queue.
It is logically similar to the behavior when both the users are in a Group and the task is assigned to the Group.


6.      Group Assignees

For this I created a group ‘sdarbhaGroup’ in WLS and added 2 users sdarbha1 and sdarbha2 in the group.
The behavior is similar to 5. (Comma Separated Users)


7.      Complex Assignees

This is a very powerful way to set assignees based on complex business requirements.
Let us assume that a particular human task has to be performed by many users with different business responsibilities and in a particular sequence etc.
For example, a task has to be completed by a data entry operator who enters some basic information, then has to be assigned to 2 of his peers and a group for review, and further has to be sent over a management chain, and finally a notification to the administrator.

First assign it to a data entry operator.


Then assign it to his 2 peers.


Along with a group at the same time.


Then send it to a management chain for review.


And finally send a notification to the Administrator.



When the task is generated following is the sequence of assignees.
The Final FYI Notification will not be visible in the task flow audit trail, but is sent to the administrator and will be visible in the BPM Workspace.



8.    Multiple Participants of different types in a Single Task Assignee Type

We can also assign the task to multiple users, groups and application roles, 
keeping the Assignee type as Single.


In this case the task will be assigned to all the users, users in the group,
and users from the application at the same time.
Any one from the above users can claim the task and work on it.
The task will be marked as completed when one user submits the task.


9.    Multiple Participants of different types in a Serial Task Assignee Type

We can also assign the task to multiple users, groups and application roles, 
keeping the Assignee type as Serial.


In this case first the task will be assigned to sdarbha3 only. 
When he submits, then only the task will be assigned to sdarbha4.
Even though the users sdarbha3, sdarbha4 are assigned at the same time in the task definition, when the task is created, they will be assigned one after the other since the task type is Serial.
But, the task is assigned to the group, all the users in the task will be assigned at the same time and anyone can claim the task and work on it.

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.