Test Dynamic Logic Integration Point

This integration point allows a user to test a section of dynamic logic that avoids any unrelated data modifications or logs retrieval.

The integration point runs a test case and returns a structured JSON document containing the bind context sent for testing, the result of the operation, and the log messages. A test case is a dynamic logic with a Test Unit signature.

The integration point returns HTTP status codes as defined in the Response Messages page.

The integration point is protected by the testdynamiclogic IP access restriction .

Operations

To run a test case, send the following request:

Table 1. Operations

HTTP Method

POST

Base URL

http://<host>:<port>/<context-root>/testdynamiclogic/{dynamicLogicCode}
where the {dynamicLogicCode} is the Code of a dynamic logic with the Test Unit signature.

Content-Type

application/json

Return Responses

The integration point returns the following HTTP status codes:

Table 2. Return Responses

Status

Description

200

Shows a successful run of the test, as the test case returns a True value.

400

Shows an unsuccessful run of the test as the test case either returns a False value or throws an exception.

404

Unable to locate a dynamic logic with the Test Unit signature or with the specified Code.

Response Body Example

To facilitate debugging, the integration point returns the log messages from the test case and the unit under test.

{
  "testUnitCode":  "<code of the Test Unit>",
  "execution": {
    "memoryAllocation": 123,
    "queryCount" :<total number of queries started while running the dynamic logic>
    "retrievedRowsCount" :<total number of rows retrieved for all the queries run while running the dynamic logic>
    "maxResultSetSize" :<highest number of rows retrieved among all the queries run>
    "logMessages": [
      {
        "timestamp": "2021-06-15T12:00:00.000+01",
        "message": "<Message>"
      },
      {
        "timestamp": "2021-06-15T12:00:01.000+01",
        "message": "<Another Message>"
      }
    ]
  }
}
The following:
  • The property memoryAllocation includes the memory allocated (in kiloBytes) by the thread while executing the unit under test. The memory allocated by the Test Unit itself is NOT included. Test Units only run in development and do not influence production. By default, the memoryAllocation property is enabled.

  • The above response body is displayed in all the scenarios. This means that, whether the test case run returns a True value (status 200) or a False value (status 400), or throws an Exception (status 400), the above response body is displayed. For True and False values the configured log messages are displayed in the response body, and for Exception the exception logs are displayed in the response body.

For a complete example of how to run a test, refer to Testing Dynamic Logic.

Implementation Details

The test case invokes another dynamic logic, or a Unit Under Test (UUT). The UUT can change data in the database. However, the transactions in a test case are set to rollback. So, when the test case invokes a UUT, the application does not commit those changes to the database. This makes the test cases independent of each other and idempotent.

Testing of a dynamic logic that interacts with other systems affects idempotency. When the UUT sends a message to another system, there is no way to prevent the after-effects of an incorrect message on the receiving system. Hence, you must test dynamic logic in Development or Test environments only.