Getting Started with Dynamic Logic

Overview

Writing correct and well performing dynamic logic of good quality is essential to any Oracle Health Insurance application. It is therefore important to use a good development process. This page outlines such a process using a simple example that applies to all Oracle Health Insurance applications. The example illustrated here is a Field Validation Rule that checks if a value is in uppercase.

Writing the Dynamic Logic

To implement the example of the Field Validation Rule, a single line is sufficient.

For example:

value == value.toUpperCase()
This dynamic logic assumes that the field 'value' always has a value.

Defining Unit Test Cases

Just like any other software that is being developed, the testing of dynamic logic also starts with writing unit test cases. The first step is to define the test cases.

For the above example, there are two test cases:

  • UPPER_TC1: When the value is not uppercase, the value False should be returned.

  • UPPER_TC2: When the value is uppercase, the value True should be returned.

Writing Test Units for Each Test Case

For each test case, a separate dynamic logic is created of signature 'Test Unit'. It is a good practice to have Test Units that only test a single test case. This way it is easy to find out what went wrong, when the Test Unit fails.

Dynamic Logic for UPPER_TC1

def input = 'lowercasevalue'
//Call the Unit under the Test
def result = test( "UPPER", [
    "value" : input
])

assert !result
true

Dynamic Logic for UPPER_TC2

def input = 'UPPERCASEVALUE'
def result = test( "UPPER", [
"value" : input
])

assert result
true
The log.error and log.info statements are added in both the branches of the 'if' statement. It is a good practice to have log statements in every branch of dynamic logic. This helps in understanding the flow of the dynamic logic.

Running the Test Units

It is important to have full test coverage of all the dynamic logic units. This means, all the possible paths of dynamic logic have to be touched by the Test Units. The complete set of all the Test Units should be run whenever something changes in an environment.

To run the Test Units, the Test Unit IP must send a POST message to:

http://[hostName]:[portNumber]/[api-context-root]/testdynamiclogic/\{Test Unit code}
All the Test Units must be started individually.

Verifying the Performance Statistics

Dynamic logic not only must be correct, it also must perform well. The performance can be checked using the Dynamic Logic Statistics Integration Point. What is acceptable performance depends upon the type of dynamic logic and on the business process from where it is called.

Running Performance Test with Volume Data

The performance of dynamic logic, that is, querying data depends on the volume of the data. There is a difference in the performance when only a few test records are there, or production volume of data is there. It is therefore essential to run a performance test with sufficient data. To monitor the performance of the dynamic logic after a performance test, use the Dynamic Logic Statistics Integration Point.