Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

This article describes how to test an API in SAP API Management.

Example case

We will test the scenario where Sales Order is posted by the message sent in SalesOrderERPCreateRequestConfirmation_In_V1 API. End to End process will be tested and validated, starting on the API Management setup and Backend interface layer where Sales Order is posted.

In the request message with Purchase Order details is send that posts Sales Order in the Backend. Then the response message is send from the backend system with confirmation.

...

Int4 IFTT will validate the SAP API Management part and at the same time it will validate created test sales order with comparison to the reference one posted with reference message saved as a test case.

Procedure

Int4 IFTT Automation Object

Int4 IFTT Automation Object was created to test the example API. More details how to create Automation Objects can be found here: Creating the configuration object for SAP API Management

...


Two variables are created for this automation object:

  • PO that stores Purchase Order number from the request payload

    Image Added

  • SO that stores Sales Order Number from VBAK-VBELN

    Image Added


    Database Comparison rules are inherited from generic automation object for Sales Order: GENERIC_SO.

In the additional parameters the following parameters are added.

...

  • ALT_RFC - alternative RFC connection created in SM59 that points where the message is sent. In the shown example RFC API_MGMT is used for this purpose. This RFC contains link to Host Alias of our API Proxy in API Portal.

    Image Added

  • SYNC_URL (3)- direct endpoint to our tested SAP API. This is the value we can copy from the API Portal from the API Base Path.

  • HTTPHEADER (2)(4)(5)

    • (2) - API Key used to authenticate user in SAP API Management

    • (4) - because in our case SOAP protocol is used - the SOAP action is defined

    • (5) - content type is defined

Test Cases Creation

Test Cases have been created manually and automatically via Robot.

...

More details on how to create test cases can be found here:Manual Test Case Creation for SAP API Management Automatic test case creation for SAP API Management

Test Cases Execution

After test cases execution the Test Results Report shows the overall status.

...

In the execution details we can see what was the endpoint URL and what were the reference and current values for Purchase and Sales Orders.

...

As response messages are also part of the test case Int4 IFTT validates whether response is exactly the same.

...

We can see that nodes Note and ID are marked as payload validation ignore lists, because it is expected that values in reference and test response will differ.

In the last step reference and tested sales orders are compared.

...