Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.
Prev | Next |
Business Knowledge Model & Test Harness
A Business Knowledge Model encapsulates logic without reflecting the usage context. It is implemented as a function definition, with parameters and a DMN expression as body (such as Decision table, Boxed Context or Literal Expressions).
Because the definition of a Business Knowledge Model is self-contained, it is possible to perform 'Unit Testing' by providing arguments for the parameters. For this reason, a Business Knowledge Model will have an 'Input Parameter Values for Simulation' tab in the DMN Expression window.
Parameters of a Business Knowledge Model
In the DMN Expression window, click on the on the toolbar to open the 'Edit Parameters' dialog:
You can perform these actions on the parameters:
- Add a new parameter by typing in the 'New Parameter...' row
- Delete an existing parameter using the context menu
- Modify the name of the existing parameter by in-place editing in the cell
- Change the type of the existing parameter
Test Harness
The Business Knowledge Models (BKMs) described in this section are available from the Model Wizard ( ); select the Requirements | Decision Modeling page.
Decision Table
Example Access:
- Create pattern for 'DMN Decision | A Complete Example'
- Navigate in the Project Browser to 'A Complete Example | Business Knowledge Models | Eligibility rules'
- Double-click on the 'Eligibility rules' element to open the BKM in the DMN Expression window
When a Decision table is created for a Business Knowledge Model, we can test this BKM by binding some values:
We can provide test values such as these:
Click on the
on the tool bar; this result is obtained:
- The runtime parameter value will take the place of 'Allowed Values' in simulation mode
- Valid rule(s) are highlighted
- Since this Decision table's hit policy is P (Priority) the final result is determined by the order of 'output values'; since 'INELIGIBLE' and 'ELIGIBLE' are the output values and 'INELIGIBLE' comes ahead of 'ELIGIBLE', rule #3 will give the final result and this applicant is 'INELIGIBLE'.
Boxed Context / Literal Expressions
Example Access:
- Create the pattern for 'DMN Business Knowledge Model | Business Knowledge Model Literal Expression'
- Navigate in the Project Browser to 'Business Knowledge Model Literal Expression | Payment'
Double-click on the 'Payment' element to open the BKM in the DMN Expression window
Similar to Decision table, the Business Knowledge Model implemented as a Boxed Expression can be tested as well.
Take this 'Payment_2_decimal' BKM as an example:
This BKM will calculate the monthly repayment based on interest rate, number of terms and principal amount.
We could provide test values such as these:
Click on the Run button on the tool bar; this result is obtained:
The runtime parameter and return value will be displayed with an equals sign '=', followed by the runtime value.
In this example, given an annual Rate of 4% for 30 years and a principal of $300,000, the monthly repayment is $1,432.25
Note: The DMN Library already has a PMT function defined; this example mainly demonstrates how Literal Expression works and how to test it with a set of arguments.