Testing the rules

You will deploy the process following the steps you followed in Chapter 3, Process Deployment and Testing, to deploy the process. You will be using following test case scenarios to test the process:

Test # 1 Values

Customer Type = New, Quantity = 100, Effective Discount = 40

   

Rule

Values (Action)

Expected

Output

Expectance Meet

Check Customer

ApprovalFlowType.customerType

true

  
 

ApprovalFlowType.newEffectiveDiscount

QuoteSummaryType.effectiveDiscount+15, that is, 55

  
 

ApprovalFlowType.NoOfTier3Levels

2

  
 

ApprovalFlowType.SelfApproved

false

  
 

ApprovalFlowType.tier1Approvalneeded

false

  
 

ApprovalFlowType.tier2Approvalneeded

true

  

Discount Check

businessAnalystRequired

true

  

Test # 2 Values

Customer Type = Premium, Quantity = 100, Effective Discount = 40

   

Check Customer

ApprovalFlowType.customerType

false

  
 

ApprovalFlowType.newEffectiveDiscount

40

  
 

ApprovalFlowType.NoOfTier3Levels

0

  
 

ApprovalFlowType.SelfApproved

True

  
 

ApprovalFlowType.tier1Approvalneeded

False

  
 

ApprovalFlowType.tier2Approvalneeded

False

  

Discount Check

businessAnalystRequired

False

  

How to do it...

  1. Go to the Oracle BPM Workspace and log in as the user sales representative, to initiate the quote.
    How to do it...
  2. Enter Quote information with Test values included since Customer Type = New, Effective Discount = 40 and Quantity = 100.
    How to do it...
  3. The quote moves ahead for managerial approval and the user/group assignment for Management Approval approves it.
    How to do it...
  4. You can now log in as BusinessAnalyst and can check the quote details and approve it too.
    How to do it...
  5. Log in as Approver to Approve Deal, and as Contracts to Approve Terms, and finalize the contract too.
  6. You can find the quote.xml file created at the destination location via the save quote service.
  7. Log in to the EM Console at http://<hostname>:<port>/em/.
  8. Go to SOA-Infra | default and click on the project name SalesToContractDemo.
  9. Click on the instance created and click on the process name in the Trace section, as shown in the following screenshot:
    How to do it...
  10. You are now in the Audit Trail section. Expand Customer Check Rule and click on the link Instance Left the activity, to show the data that was associated with this rule when the process token left this Business Rule.
    How to do it...
  11. In the Payload section, check on the values and match it with the values in test scenarios.
  12. Similarly, click on Discount Check and confirm for BusinessPractiseReviewRequired = True. As the Business Analyst Review is performed for the process, you can confirm it as true.
  13. Similarly, run a new instance of the process, and this time, enter new Quote values as per test case # 2, with Customer Type = Premium, Effective Discount = 40 and quantity = 100.
  14. In the Audit Trail tab you can find that the values at Discount Check are as expected.
    How to do it...
  15. Now, you can update the test document where Expected = Output and Expectance meet = Yes, for all rows, as follows:

Test # 1 Values

Customer Type = New, Quantity = 100, Effective Discount = 40

   

Rule

Values (Action)

Expected

Output

Expectance Meet

Check Customer

ApprovalFlowType.customerType

true

true

Yes

 

ApprovalFlowType.newEffectiveDiscount

QuoteSummaryType.effectiveDiscount +15;that is, 55

55

Yes

 

ApprovalFlowType.NoOfTier3Levels

2

2

Yes

 

ApprovalFlowType.SelfApproved

false

false

Yes

 

ApprovalFlowType.tier1Approvalneeded

false

false

Yes

 

ApprovalFlowType.tier2Approvalneeded

true

true

Yes

Discount Check

businessAnalystRequired

true

true

Yes

Test # 2 Values

Customer Type = Premium, Quantity = 100, Effective Discount = 40

   

Check Customer

ApprovalFlowType.customerType

false

false

Yes

 

ApprovalFlowType.newEffectiveDiscount

40

40

Yes

 

ApprovalFlowType.NoOfTier3Levels

0

0

Yes

 

ApprovalFlowType.SelfApproved

true

true

Yes

 

ApprovalFlowType.tier1Approvalneeded

false

false

Yes

 

ApprovalFlowType.tier2Approvalneeded

false

false

Yes

Discount Check

businessAnalystRequired

false

false

Yes

How it works...

First, a Rule session that consists of rules, facts, and an agenda, is created. An assert or retract rule adds or removes fact instances from working memory.

After this, the following actions take place:

  • Conditions for rules are evaluated
  • Matching rules are added to the agenda (Activated)
  • Rules that no longer match are removed from the agenda
  • Rules Engine runs and executes actions (fires), for activated rules

So, for the first case, the Check Customer rule is executed and process token ahead for management approval and business analyst review will be required. However, for the second test case, no management approval was required and no business analyst review was required, as the conditions for the rules were set so for those two cases.

You can go ahead and run other cases, too. They would be something like Enter Quote with Customer Type as Gold, Quantity as 100 and Effective Discount as 40 and check for the process.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.54.255