Testing SAP API Management

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. The end-to-end process will be tested and validated, starting on the API Management setup and Backend interface layer where Sales Order is posted.

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

 

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

Procedure

Int4 IFTT Automation Object

Int4 IFTT Automation Object was created to test the example API. You can find more details on creating Automation Objects here:: https://int4support.atlassian.net/wiki/spaces/IUM/pages/1705082881


Two variables are created for this automation object:

  • PO that stores Purchase Order number from the request payload

     

  • SO that stores Sales Order Number from VBAK-VBELN


    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 a link to Host Alias of our API Proxy in the API Portal.

     

  • SYNC_URL (3)- direct endpoint to our tested SAP API. This parameter 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 a 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.

You can find more details on creating test cases here: https://int4support.atlassian.net/wiki/spaces/IUM/pages/1704394812 https://int4support.atlassian.net/wiki/spaces/IUM/pages/1704165417

Test Cases Execution

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

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

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

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

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

 

© 2017 - 2022 Int4 AG All rights reserved