Skip to Content
Product Information

How to use “if and else” in the SAP S/4HANA Cloud Essentials Test Automation Tool

Hello Everyone,

In my previous blog post, I’ve explained how you can read multiple dynamic values from the SAP S/4HANA Cloud Essentials Test Automation Tool.

Today, I’ll be explaining you another very useful feature of the SAP S/4 HANA Essentials Cloud Test Automation tool.

Many a times our customers have asked us is “How to apply conditional loop, especially if and else”  in the Cloud Test Automation Tool.

To ease customer testing activities in SAP S/4HANA Cloud, SAP delivers the test automation tool along with the detailed test scripts for each business process for SAP S/4HANA Cloud. The test automation tool delivers pre-scripted test process(test automates) for most of the business processes in SAP S/4HANA Cloud. This Test Automation Tool is available for customers in their SAP S/4HANA Cloud Q-systems.

To know more about the Test Automation Tool, you can check the testing work-stream in the roadmap viewer- here

In order to use an if and else in the test automation tool, we need to use the $SKIP formula.

The formula can be used to skip a certain number of steps based on a given condition or previous step’s status.

The syntax for the formula is : $SKIP[<Condition>, <No of Steps to be skipped>]

For example- $SKIP[$PREVSTEPSTATUS.equals(‘true’),4]   —  This will skip the 4 steps including the current step if the previous step has passed.

Let’s look how to apply this formula in the tool itself discussing the below example

The below screenshot if of the app Create Sales Document

Create%20Sales%20Document%20application%20%281%29

Create Sales Document application (1)

For most of the customers, the SSCUIs (Self- Service Configuration User Interfaces) settings are such that they do not need to enter the Sales Organization, Distribution Channel and Division,  they are automatically been taken from the configurations.Therefore, in this case what we want from our automate is that our automate enters the Sales Order Type and checks if its entered and then can skip the next three steps of entering the  Sales Organization, Distribution Channel and Division.

The below screenshot is for the Manage your test process app, where we are using a conditional loop (  if and else ).  What we want from the automate is at action number 4, the Sales Document Type values is read, the automate should skip the below highlighted 3 steps of entering the  Sales Organization, Distribution Channel and Division.

Manage%20Your%20Test%20Process%20Application%20%282%29

Manage Your Test Process Application (2)

 

Process- Go to the edit mode of your automate and click on the Edit Details  links on the action number 5 and in the Formula Name field enter the formula $SKIP[$PREVSTEPSTATUS.equals(‘true’),3] and click on OK as shown below-

Use%20of%20%24SKIP%20Formula%20%283%29

Use of $SKIP Formula (3)

This will skip the 3 steps (action number 5,6,7- inputting the Distribution Channel, Sales Organization and Division)  including the current step (action number 5 ) if the previous step (reading of the Sales Document Type) has passed.

Once, the formula is in place you can save your test process.
You can view your formula in the  Manage Your Test Process App-

View%20the%20formula%20applied%20%284%29

View the formula applied (4)

 

After the automate is ready, we can execute the same by making a Test plan in the Test your process  app. Let’s look at the results now in the below video with explanation-

 

 

After watching the above video, the audience can get a fair understanding of how the SKIP formula can be used in the Cloud Test Automation Tool.

Similarly, there are other different ways of using $SKIP formula, there syntax are as follows:-

  • $SKIP[$REPLACEWITH[E_LABEL].equals(‘Result Not Found’), 2] – This will make the current as well as next step to be skipped if the previously exported value of E_LABEL is equal to “Result Not Found”.
  • $SKIP[$PREVSTEPSTATUS.equals(‘true’),2] — This will skip the current step and next step if the previous step has passed.
  • $SKIP[$REPLACEWITH[E_COUNT]>100, 2] — This will skip the current and next step if exported value E_COUNT is greater than 100.
  • $SKIP[$REPLACEWITH(E_ARROW_DOWN).equals(‘MRP Area’), 2]— This will skip 2 steps if previously Exported value is equal to ‘MRP Area’
    Note: $PREVSTEPSTATUS is not for use individually, it gives the previous step’s status.
  • $SKIP[$CURRSTEPVALUE.equals(‘Campaign Management’),2] — This will skip 2 steps if current step value is Campaign Management.

So, today we have learned how to use $SKIP  formula which can cater the need of “if and else” in the Cloud Test Automation Tool. This tutorial will help the customers for their testing cycle leveraging  the Cloud Test Automation Tool.

Happy Testing!

 

-Sonam Saxena
Topic Expert, Expertise Services Team

 

 

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.