In this article you will learn:
Reading time: 8 minutes
On my previous blog “Int4 IFTT Database Comparison Rules”, I am mentioning Int4 IFTT variables. So, what are those variables, when should we use them and how to do the configuration? If you are looking for smart and efficient regression testing, Int4 IFTT variables can deal with some complex and demanding scenarios. All these topics will be explained extensively in this article.
What are the Int4 IFTT variables?
They are nothing more than simple configurable variables, which are used during the test case creation, execution, and validation.
Variables are the container for values that can be used during regression testing. Each variable contains two values, one fetched based on the reference message/document and the one fetched ad-hoc during test case execution.
In which regression testing scenarios do we use Int4 IFTT variables?
The use cases of variables are plenty and I am specifying some of them, so if you are looking for an exact regression test case solution it will be listed below.
- During test case creation you can use a variable in order to search for a proper message based on a specific field value.
- For inbound test cases, they are used to substitute particular fields of original payload messages to avoid posting duplicates or just for testing needs.
- They are used to correlate interface messages with documents posted in the backend systems.
- In outbound test cases they are used to search the middleware platforms to find a proper message that would be validated as a part of a test case.
- In complex regression testing scenarios, variables are used to store and transfer values between sequential test cases. For example, we can have a scenario where the inbound Sales Order is posted in our system and then a Sales Order Confirmation is sent back. So, using a variable we can store the inbound Sales Order number and use this number to fetch the proper Sales Order Confirmation message and validate it according to our needs.
- Before the test case execution, you can pre-populate the values of the predefined variables, so the test case can be tested according to our needs.
- Also, variables are used to compare values of any specific fields between the saved message and the newly created one during test case execution.
How Int4 IFTT variables process
You can define multiple variables for each Int4 IFTT Configuration Object. During this configuration, you can specify a set of variable processes for each created variable. The specified variable processes define how and when the selected variable is going to be handled. Each variable processing instruction contains an Action, a Variable Procedure, and a Processing Parameter.
Let’s get into some details of each Int4 IFTT variable processing configuration element.
Action specifies when and in which situation the Variable Procedure will be triggered. As I already mentioned it is very important to understand that, each variable contains a container with two values, the one (reference value) that is calculated based on the reference message/document and the one (current value) that is calculated ad-hoc during test case execution.
There are four predefined actions to choose from, in order to fulfill your requirements:
- Populate variable before execution:
This action is triggered before test case execution. It is used to load to the variable container the reference value.
- Generate value for a new message:
This action is triggered before test case execution. It is used to generate new values and to substitute the message that will be injected into the middleware for processing. The values will be stored in the container as current values.
Action must be always preceded by action Populate variable before execution to spot the place in the message that will be substituted with a new value.
- Populate variable after execution:
This action is triggered after the execution of the test case and will populate value from assertion results into reference and current value fields in the container.
- Locate new message using variable value:
This action is limited only to outbound test types. This testing type must be preceded by other test case that will trigger the interface document to the middleware. This might be an eCATT recording, another interface posting that triggers the response or calls by API from external testing software.
The action will be triggered to find a specific message in the middleware. The value that would be searched must be previously read by action Populate variable before execution
Variable Procedure defines how the value of the variable will be loaded or how the variable should be filled with a new ad-hoc generated value during test case execution. For each action, there are different procedures available that allow us to accomplish various scenarios.
Please find below the list with the available variable procedures for each action.
Action – Populate variable before execution:
- Read variable from the saved message (XPath):
Populate the variable with value fetched from the saved reference input payload. The value is fetched by running the XPath expression or Int4 Flat File syntax (depending on message format).
Apart from loading value, the place in the message will be marked and used by the next action “Generate value for the new message” to substitute reference value with a new one.
The XPath or flat expression must be provided as a string in the parameter field. XPath expressions must be ended with /text() function to extract node value, not the node object.
- Read variable from the previous case:
This procedure can be used only for test cases configured to run in sequence. It will load the variable value from the previous test case. The variable name from previous test cases must be provided as a parameter. Test cases are linked in sequence in the test cockpit.
- Read the user-defined value from the cockpit:
The variable is populated using the value provided by the user during the test case creation. The value is provided for each variable only once per test case.
Action – Generate value for a new message
- Replace value with constant:
The current value will contain the constant passed in processing parameter. The constant should be provided as is without any brackets.
- Generate GUID:
Generate random value in a GUID format.
- Generate number from number range:
generate value for a new message from a predefined number range. This is the most common way to generate new document numbers in end-to-end testing together with SAP back-end. Please provide as parameter the name of the Int4 IFTT number range that was created for the particular variable.
- Generate random value:
generates a random value. The value of the parameter defines the upper limit of the range. it is possible also to generate negative numbers. For example, passing -100 in parameter will generate random numbers from -1 to -100
- add prefix:
use reference value read by the previous action and add prefix specified in the parameter. This might be useful to indicate other systems that messages are coming from automated testing.
- add suffix:
use reference value read by the previous action and add suffix specified in the parameter. This might be useful to indicate other systems that messages are coming from automated testing.
- Read variable from the previous case:
This procedure can be used only for test cases run in sequence. It will load the variable value from the previous test case. The variable name from the previous test cases must be provided as a parameter. Test cases are linked in sequence in the test cockpit.
Action – Populate value for a new message
- Read variable from DB res (XPath):
Populates variables with data obtained from the Data Base. As a prerequisite, the configuration object must contain database comparison rules and choose for comparison tables and fields that later on will be loaded to the variable. The field and table are specified in the parameter as XPath expression.
if there would be more than one value then all of them will be returned. Additionally, you can extract a particular row by adding its number. I will present you with such a case in the example section.
- Read variable from eCATT log (XPath):
If test type is eCATT a variable can be populated from the eCATT execution log. The value is obtained from the log using the XPath expression. see details here.
- Read variable from outbound msg (XPath):
Applicable only for the outbound test types. Populates variable with data fetched from outbound message using XPath or flat expression after test case execution. The expression is passed in the parameter field.
Action – Locate new message using a variable value
- Find using XPath:
This procedure will search all middleware messages of the current tested interface from a recent period to look for value loaded by action populate variable before execution.
The value will be checked in the field specified by XPath or flat-file expression and passed as a parameter.
The XPath expression, like in other cases, must be ended with text() function.
- XPath value contains Variable:
Similar to Find using XPath procedure but it will not require the variable value to be equal to the value extracted by XPath expression.
It will check if the value extracted by the expression contains the variable value.
- The variable contains XPath value:
Similar to the previous procedure, however in this case the variable needs to contain the value extracted by the expression.
Processing Parameter is an input string with instruction that is consumed by the variable procedure.
As pointed in the variable procedure explanation points most of the time for processing the parameter you need to provide an XPath or flat-file expression.
<h3id=”4″>Example Int4 IFTT variables configuration
Let me provide you with an actual use case scenario.
We have Inbound Sales Orders documents through SAP PO to our SAP S/4 HANA system (IDOC: ORDERS05, message type: ORDERS). After the document gets posted, automatically there is a Sales Order
Confirmation document generated and send back (IDOC: ORDERS05, message type: ORDRSP).
We want to test this scenario end to end, that means, we are going to validate:
- The inbound Sales Order actually posted IDOC
- The outbound Sales Order Confirmation the actual outbound message from PO
In order to validate those two types of documents, we will need two Int4 IFTT Automation Objects.
One for the Inbound interface and one for the Outbound. The test cases need to communicate with each other in order to identify the right Sales Order Confirmations based on each Sales Order. This communication between the test cases is possible after configuring the Int4 IFTT variables. So let’s go and have a look at a step by step configuration for this scenario.
The Int4 IFTT variables configuration is under the Int4 IFTT Automation Objects.
Go to transaction /int4/iftt_conf_mass and create a new Int4 IFTT Automation Object.
Select the Automation Object that you want to configure and double click on Variables.
New Int4 IFTT Automation Object VARIABLES_SALESORDER
Create a new variable.
Select it and double click on Variable Processing.
New Variable DOCNUM for Automation Object VARIABLES_SALESORDER
One more interesting thing that we want to implement at this point, is creating a new document number for every test case execution. This way we are going to avoid posting duplicates on both systems, our posted document will have a unique predefined document number and we are going to be able to identify the documents created by Int4 IFTT.
So, the first Action that we need is “Read variable before execution” and we choose the variable processing “Read variable from the saved message (XPath)”. For processing parameters, we need to provide the actual XPath expression. In our case:
In order to create a new document number, I will use another interesting feature of Int4 IFTT, the Number Ranges. I created a proper Number Range for this scenario named NR_DOCNUM.
Now, we need the “Generate Value for new message” Action and “Generate value from number range” as variable processing. For processing parameters just provide the Number range name.
Variable Processing Configuration for variable DOCNUM
The first Int4 IFTT Automation Object is ready. Now, let’s configure the second one.
Again, create a new Automation object and create a new Variable for it.
New Variable DOCNUM for Automation Object VARIABLES_SALESORDERCONF
The first variable processing action for this Object will be again “Read variable before execution”. But now as a variable process, we choose “Read variable from previous test case” and provide as a processing parameter the name of the variable from the previous automation object. This way you can pass variable values from one test case to another. Please note that variables can store multiple values during one test case execution.
The last action that we need is “Locate new message using the variable value” and the procedure “Find using XPath”. The last thing is to provide the correct XPath expression in the Processing Parameter.
Variable Processing Configuration for variable DOCNUM
That way you can create sequential test cases to any document type of this kind.
You can read more about testing end-to-end business processes, with a great complete testing example, in the blog “Testing business processes with Int4 IFTT” by Krzysztof Łuka.
Int4 IFTT variables form the core configuration for smart and effective regression testing. After reading this article, you should understand the functional and technical details about the Int4 IFTT variables. Moreover, now you should be able to configure the Int4 IFTT variables on your own.
Do not forget to check out the rest of our Int4 blogs and learn more interesting features of Int4 IFTT. If you want to find out more about this (or other) Int4 IFTT features, just book a consultation with the product demo or contact us.