The SAP S/4HANA Cloud Test Automation Tool helps in accelerating business process testing and regression tests. The tool supports standard UI Automation as a way of creating automates and with release CE2105 it was further extended to support API test automation to cater to the needs of our S/4HANA Cloud customers having many options for configurability and extensions.
The primary use-case of integrating the API framework with the Test Automation Tool is to support the automation of SAP S/4HANA Cloud public APIs. We can also achieve seamless integration with the current UI test automation framework where you can create process steps with UI automation and chain it with API automates together into one end to end process. The API framework enables the creation of multiple UI variations in a single automate hence reducing the number of test artefacts created. Support is mainly offered for the automation of both SOAP inbound as well as OData V2 and V4 APIs. As of today the framework supports offered to 459 OData and 123 SOAP APIs.
Benefits of the API framework
Considering that UI automates might be impacted by changes in underlying application as part of the regular software upgrades, API based execution brings out the following advantages:
- Robustness – Since API automates are not UI dependent and are completely based on SAP S/4HANA Public Cloud APIs delivered, it makes the framework consistent and robust until there is a change in the API itself
- Smart payload generation – An extremely simple way to generate payloads without knowing how to work with APIs is a unique ability of this framework. Business/functional experts and technical experts can equally work towards generation of payloads
- Performance – It takes minimal amount of time to execute an API test automate as there is a single action present for each process step with quick execution in the background.
- Extensions – API automates enable an end user to extend API payloads with multiple line items. This can simply be achieved using Copy-Paste functionality in the smart payload tree structure.
The API framework ensures efficient, rapid, and reliable solution for easy and quick API automation with a no-code approach. We can easily build automation scenarios which could contain the chaining of both UI and API process steps. The API Framework is based on public APIs that are available on the Business accelerator Hub and supports both ODATA APIs and SOAP APIs (inbound) and allows an end user to create an automated test case or process using a particular API. With the help of a user-friendly guided wizard, one can perform different CRUD operations (Create/Read/Update/Delete) on multiple entities present for that API.
Working with API automates
For creation of an API automate, the end user is provided with a guided step-by-step wizard where one must select the API Type (ODATA/SOAP) and an S/4HANA Public API from the provided value help. These APIs are available on the SAP Business Accelerator Hub.
The Test Automation Tool is designed to support both Business users and more experienced technical users as well. The guided wizard simplifies the process of creating an API test process with ease. Once the desired API is selected, one needs to select Entity types, methods, Operation Types, Entity Operations based on the API type selected.
In case where API requires an input payload, a payload structure will be provided to the end user for populating the payload values so that the test case can be generated. The Payload Structure can be viewed in two ways (as shown in below screenshots):
- Smart View: Payload will be visible in tree table format i.e hierarchical structure that would be easy to understand and manipulate for business users.
The following operations can be performed on the smart tree structure -
- Copy and Paste – Used to extend payload (e.g extending line items of an entity)
- Delete – Used to delete a certain payload property (if applicable)
- Undo and Redo – To undo and redo the changes
- Expand All – To expand the tree structure to the lowest level
- Collapse All – To collapse the tree structure
- Code View: Payload will be visible in technical format (json/xml) that would be useful for technical users.
Smart View:
Code View:
As a user, you will have the provision to assert and export data from the API response also. Once an API test process is generated, the same can be consumed in Test Your Processes application for execution. Upon execution of the test plan, API logs are generated containing the below information:
- Request Information – API URL and Used Variables
- Input Payload – Payload structure with values
- API Execution Response – Actual API response
- Assertions (Check Conditions) – Status (Success/Failed)
- Export Response – Exported data which can be passed to the next process step
For API executions to take place, pre-requisites need to be maintained such as a communication role needs to be setup as per communication scenario/arrangement maintained for a particular API. Also, a communication arrangement with basic authentication as the supported authentication method must be active.
Integration with Test Data Container
For populating the values in an API automate payload, user will have the provision to select any value from the provided value help for each input field in payload.
Using value help, one can select any of the following options (as shown in below screenshot):
- System Variables – Predefined variables
- Step Variables – Previous Step variables
- Bind with TDC - TDC parameters
For TDC binding in payload, user needs to make sure that TDCs are added for a particular test process or test plan. Then using the value help, any TDC and the corresponding parameters can be selected for binding payload property.
In case user wants to bind TDC data with complete payload structure, ‘Bind TDC Field’ feature can be used using which mapping (Auto-bind and Manual) can be done for API payload and TDC data.
Use Cases
An API automate can be used/executed as per below use cases:
Chaining UI and API process steps
An API automate can be used with any UI automate thereby allowing chaining of UI and API automates.
e.g., In a test process, Sales Order can be created using UI automate and Outbound Delivery can be created using API automate and vice versa.
Import Functionality
Process steps from an API automate can be imported to any other automate. Please note that it might require necessary changes (e.g., data binding changes) depending on the step position where it is getting imported.
Scoping via Manage Upgrade Tests app
API automates can be scoped via the Manage Upgrade tests App as a part of a suite built where the user decides the list of specific automates which need to be executed after an upgrade. This scope is directly triggered from Test your processes app as part of the upgrade process.
Enhancing UI automates
It is also possible for an end user to enhance an UI automate with its corresponding API automate. Enhancement /replacement can be done using provided value help feature for process steps where one can select the new step that will enhance/replace the existing step. API test plans can be created and checked to ensure that the API is working as intended after the release.
Multiple UI variations in a single automate
It is very easy to create multiple variations in a single API automate by just changing the payload parameters and creating different variants to generate different flows of an automate.
e.g., Two different flows which differ on the aspects of pricing conditions which could be automatic, or manual based on the type of customer and based on the quantity they procure can be catered to in the same automate
Further Helpful Links
Working with Standard Automates
Work with API Payloads
Editing of API Test Process steps
Adding test data containers (TDCs) to test processes and binding the TDC fields with test process st...
FAQ of Test Automation tool
Blog Post on Test Data Container
Creating a Communication Arrangement in SAP S/4HANA Cloud