Creating a test case for a REST API operation subflow

You can create and run a test case for 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.

For information about how to use the IBM App Connect Enterprise Toolkit to generate a test case for an individual message flow node in a REST API subflow, see Creating a test case for a message flow node in a REST API operation subflow.

The following video demonstrates how to create a JUnit test for an operation in a REST API: Generating a test case for a REST API operation. The capability can be used on REST APIs that are using Open API v2.0 or v3.0 documents, which define the APIs.

For more videos about generating and running tests, see the IBM App Connect Enterprise playlist on YouTube.

To create a test case for a whole REST API operation subflow, complete the following steps:

Procedure

  1. In the Application Development view, right-click the operation subflow and then click Create Operation Test Case.
    Figure 1. Create Operation Test Case option in the Application Development view
    This diagram shows the Create Operation Test Case menu item in the Application Development view of the toolkit.
  2. The Create test case wizard 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.

    Local environment entries for HTTP and REST are defined in the generated test case, using the path or query parameters for the operation. The input message assembly can be generated using the local environment entries.

    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.

    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.