Creating a test case for a message flow node in a REST API operation subflow

You can create and run a test case for an individual message flow node in a REST API operation subflow.

Before you begin

Read the following topics:

About this task

REST API operations are implemented by subflows, and the OpenAPI document for the REST API describes the input and output messages that are used by each operation.

You can generate a test case for an individual message flow node in a REST API operation subflow, by following these steps:

Procedure

  1. In the Application Development view of the Toolkit, open the REST API operation subflow that contains the node that you want to test, right-click the node, and then click Create Test Case.
    Figure 1. Create Test Case option in the Application Development view
    This diagram shows the Create Test Case menu item in the Application Development view of the Toolkit.
  2. The Create test case dialog is displayed, containing a read-only preview of the generated test case.

    The OpenAPI document defines the message format used by each operation, and an instance of the message is generated and used to create the message assembly in the test case.

    Figure 2. Create test case dialog for a REST API operation subflow
    This diagram shows the Create test case dialog for a REST API operation subflow.
    The node to be tested (in this case a Mapping node) is specified in the SpyObjectReference object in the generated test case, as shown in the following example:
    
    // Define the SpyObjectReference
    	SpyObjectReference nodeReference = new SpyObjectReference().application("CustomerDatabaseV1").messageFlow("gen.CustomerDatabaseV1").subflowNode("getCustomer (Implementation)").node("Mapping");
    If you generate a test case for a whole subflow, no node is specified in the SpyObjectReference object definition:
    
    // Define the SpyObjectReference
    	SpyObjectReference nodeReference = new SpyObjectReference().application("CustomerDatabaseV1").messageFlow("gen.CustomerDatabaseV1").node("getCustomer (Implementation)");

    For an example of a test case generated for a GET operation, see Example test case for a REST API GET operation.

  3. Click Finish.