Skip to Content
Technical Articles
Author's profile photo Sonam Kukreja

Step by Step Guide – Running Automation Script in SAP Cloud ALM

Introduction

In this blog post, I want to share my recent experience of working on an S/4HANA Cloud implementation for a well-known customer in Australia. During this project, my role was to conduct testing using the SAP Cloud automation tool. As we were following the best practices implementation for the customer for phase 1, the testing scope was limited to automation testing using the best practices script.

Throughout the project, I gained valuable insights and learning opportunities that I believe could be beneficial to others who are planning to undertake similar projects. In this blog post, I will focus on sharing these learnings in the hopes of helping others, especially those who are new to the field.

So, if you are someone who is interested in SAP Cloud automation testing or is planning to undertake a similar project, then keep reading to learn more about my experiences and the valuable lessons I learned on this project.

For the purpose of this blog, I have chosen the best practice BD9, which is “Sell from Stock.”

To better understand the process, I encourage users to go through the process first to become familiar with this well-known process in the S/4HANA space.

Sell from Stock (BD9) (ondemand.com)

Pre-Requisites

To start with the SAP S/4HANA Cloud tenant should be Integrated with SAP Cloud ALM. This has been covered quite in detail in other blog posts.

Integrating SAP Cloud ALM and the Test Automation Tool [TAT] for SAP S/4 HANA Cloud | SAP Blogs

Test Preparation

Test Preparation

As with any test planning exercise, we will start the test preparation work on our BD9 script. As its a standard best practice item, the test case can be created directly in Cloud ALM using the steps below

Test%20Preparation

Test Preparation

Create New Automated Type Test Case

As stated earlier, for the purpose of this blog we are going to use the solution process BD9.

Create%20Auto%20Test%20Case

Create Auto Test Case

Synchronize Test Cases

After creating the test case in Cloud ALM, synchronize it with your S/4HANA test tenant, where the SAP S/4HANA Cloud Automation tool will run. Press the button below to synchronize the test case.

Synchronize%20CALM%20Content%20with%20S/4%20Tenant

Synchronize%20CALM%20Content%20with%20S/4%20Tenant

Synchronize CALM Content with S/4 Tenant

The above step will generate a test plan automatically which can be viewed inside the Test Your Processes app. Details in the later section of this blog.

Design Time: Create, Manage and Customize your end-to-end Processes

As part of the design phase you can use the Manage Your Test Processes Fiori App to create and manage end-to-end test process.

Every test process is a set of one or more process steps and a process step is a series of actions which we will see in a bit more detail in subsequent steps. As part of the design work, the automation tester will spend considerable time in customizing and adapting the process steps and actions within them to align with the business process and requirements. Further, the effort will be spent on setting up test data containers relevant for the solution process and its associated data variants.

Create Test Data Container

The test data container are added to the test process and customers can create their own test data containers where needed. Please note that standard test data containers can be enhanced with additional fields if needed by your business process. SAP has provided lots of standard SAP TDC to support the various S/4HANA business processes and most of the time they have enough attributes within a container to support the test process.

The standard best practice scripts, comes with the appropriate Test Data Container. For BD9, the test data container is Sales Order Management and Processing

Test%20Data%20Container

Test Data Container

Create Variants for Test Data Container

With the variants feature, flexibility is offered to the customers in terms of re-using the same container with different sets of data. For instance, one can maintain different variants for different company codes and each variant will have its own set of data that will be used in the end-to-end process.

The variants can be accessed by clicking the test data container inside the Manage Your Test Processes App.

 

Test%20Data%20Container

Test Data Container

In my project, I had to run the BD9 process across multiple company codes and hence I created multiple variants for the test process.

Each variant based on its company code can have its own set of data including Customer, Supplier, Material etc and can be managed mutually exclusively using the variants.

Variants

Variants

Customize End-to-End Process

Once the standard BD9 script is synchronized to the test tenant, the next step is to adapt/customize the standard process to your needs. This can include removing or adding new process steps as per your requirements. This is done in the Manage your Test Processes Fiori App.

Please note that the standard SAP scripts are quite detailed and most of the times need modifications to achieve a successful run. Based on my experience the standard script without any modifications could fail for some reasons. Examples below

  • Certain Steps in standard script are mandatory, however they are optional or not required in your end-to end process.
  • A different S/4HANA App might be used in your end-to-end process compared to what you have in standard script.
  • S/4HANA Public cloud has evolved since the time script was originally recorded and certain screen elements are missing or new ones have been introduced in the standard S/4HANA apps.

Whatever, be the reason, the good thing is that the scripts are flexible in nature and give a good starting point for customer to tailor them to their requirements.

For more details on how to perform these modifications, there is an excellent blog series from Sonam Saxena

https://blogs.sap.com/?p=1387629

https://blogs.sap.com/?p=1387932

https://blogs.sap.com/?p=1388169

As can be seen below, the below process has been customized as the type shows Custom(UI) in the type column

Process%20Steps

Process Steps

Field Binding – Binding TDC Fields to Process Input and Select Fields

Once you are happy with the TDC, variants, data and the process steps customizations, the next step is to bind the TDC to the Input and Select fields from the process steps inside the Manage Your Test Processes App.

You can use Auto BIND feature, however based on my experience it does not bind appropriately all your required fields and hence manual always works.

Select the appropriate input or select field on left hand side and select the field from the TDC on the right side and Click Bind Button as shown

Field%20Binding

Field Binding

Run Time: Create, Manage and Execute Test Plans

Manage Test Plan

The test case that we created in SAP S/4HANA Cloud ALM, automatically generates a test plan inside the Test Your Processes Fiori App. This app also allows to create and manage the test plans manually, however as the scope of this blog is running end-to-end test process via Cloud ALM, we don’t have to create any test plan here manually.

Test%20Your%20Processes%20-%20Test%20Plan

Test Your Processes – Test Plan

Assign Data Variant

In this step, you will assign the variants that were created inside the test data container.

 

Assign%20Data%20Variant

Assign Data Variant

Execute Test Plan

For this step, you can log back to SAP Cloud ALM and click on the Test Execution Tile.

Test%20Execution%28CALM%29

Test Execution(CALM)

Run Test Case: Click on Execute Button

Execute%20Test%20Case

Execute Test Case

Analyze Results and Errors

The execution results and progress can be viewed inside the Test Your Processes Fiori app, under the logs section. Execution summaries with screenshots can also be downloaded by clicking on the Download button as shown.

The status column highlights the successful run and the runs with errors.

Logs%20and%20Errors

Logs and Errors

 

In conclusion, there are several ways to include automation testing scope in your S/4HANA project. By following the above steps, teams can not only fast-track their release strategies for production environments and optimize continuous delivery pipelines, but also gain significant benefits from other applications such as Analyze Automated Test Results. These applications provide full visibility of the test processes during the implementation lifecycle, which can help teams improve their testing methodologies. In addition, my experience with the tool has shown that once it is set up properly, it can accelerate delivery, avoid over-testing and reduce technical debt. This is because everything is wrapped up in the same S/4HANA applications stack, which minimizes the need for additional tools and resources.

Assigned Tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Joy Kennedy
      Joy Kennedy

      This is a great blog, it's worth noting that the correct branding for S/4HANA contains no spacing and no lowercase letters.

      Author's profile photo Sonam Kukreja
      Sonam Kukreja
      Blog Post Author

      Thanks for the feedback Joy. I have made the adjustments.

      Author's profile photo Pekka Korsoff
      Pekka Korsoff

      Hi Sonam,

      I have been trying the TDC usage with the BP Process BJ5. I have found one issue that is a bit annoying: How to get an understanding of the field bindings that have been defined in the standard test script?

      In this example TDC (PRODUCTION OPERATIONS) there are 10-20 data fields available for each material type: Finished products, Semifinished products and Raw materials and it seems to be totally arbitrary how the bindings have been done. For example, there are ~10 Raw materials used in the test script, but there are bindings to Raw material data fields in the range 11-20 in the test script, and probably not all of the fields in the range 1-10 have been bound to any field in the test script.

      It is a bit tedious work to run the test, find out where it stopped with an error due to incorrect binding, correct the binding and retest and then the same thing over and over again ...

      I hope and believe there is an easier way, but I have not been able to figure it out.

      Best regards,

      Pekka

       

      Author's profile photo Sonam Kukreja
      Sonam Kukreja
      Blog Post Author

      Hi Pekka,

      The field bindings in the standard test script can be checked by running the script in the first go, in the logs you can see where those fields are mapped to.
      You are right, about the arbitary bindings, especially for the materials (Around 10). I think the reason why SAP did this, is because the same TDC is shared across
      multiple scope items and they were trying to create something reusable. You don't have to use all of them and use what you need based on the script logic.

      You are absolutely right that is tedious and you have to correct it as you progress. I think the easier way that I am going to use in the next phase of my project is to
      do my own recording. You can check a few videos on youtube which show how to record your own custom script.

      Rgds
      Sonam

      Author's profile photo Pekka Korsoff
      Pekka Korsoff

      Hi Sonam,

      Thanks for the prompt reply. It would be nice if SAP provided some documentation on the test scripts including the default bindings to the TDC fields and/or an example TDC including also the field values used in the standard test scripts.

      But in reality we anyway need to build our own TDCs and field bindings. Looking forward to your videos on the custom-built scripts.

      Best regards,

      Pekka

      Author's profile photo Shyam Viswanathan
      Shyam Viswanathan

      Great blog ! Loved the content