Document toolboxDocument toolbox

Configuration for Transform Test Messages by XSLT

USE:

It can happen that during, for example, migration projects, field names or the structure of the payload may change. The new interface can also generate values in a different order. To execute test cases in such scenarios, you can take advantage of the transformation functionality.

XSLT Transformation can be applied on both Input and Output payloads and will be stored in a reference test case. This test case will be used afterward in Automation Object Configuration.

Apart from the example below, there is a separate page with the most common solutions: XSLT transformation examples

EXAMPLE:

Let’s take as an example Interface for Sales Order creation. For some reasons, the structure of the payload message was changed:

  • the node ‘Quantity’ is now reflected by the node ‘Qty,’

  • the node ‘ProductName’ is now reflected by the node ‘Product’.

If we execute such a test case (with a different payload structure), it will surely fail since Qty and Product fields are not mapped correctly:

Differences between the Reference and Current Execution:

We can apply an XSLT transformation to solve this issue.

PROCEDURE:

In our case, we need to apply the XSLT mapping to the input message. As mentioned previously, this can be achieved by transformation settings for Automation Object.

  1. Prepare the XSLT mapping for a message. Create a test case with type 10 - PI Manual Inbound and copy your prepared message mapping to the content of the test case. Our example transformation:

    Save the content and the test case.

  2. Open Automation Object configuration (/INT4/IFTT_CONF_MASS or /INT4/IFTT_CONF). Select your Automation Object and open Additional Parameters section.
    There are four parameters for XSLT transformation:

Parameter Name

Description

Parameter Name

Description

XSLT_INPUT

Execute XSLT on input payload

XSLT_INP2

Execute XSLT on input payload after variable processing and replacement

XSLT_OUT

Execute XSLT on reference output payload

XSLT_OUTC

Execute XSLT on output payload from current test case execution


Choose parameters based on your requirements (you can use all of them at the same time). In our example, we are using XSLT_INPUT as we need to apply a transformation to the input payload


It is also possible to run multiple XSLT transformations at a single stage (e.g., XSLT_INPUT). To achieve this, maintain multiple additional parameters with the same Parameter name and different values in the Group column. Value in the Group column will be used to sort the transformations and run them in a particular order.

  1. In the Parameter Value column, enter the test case that stores XSLT transformation (the test case created in step 1.). Save the configuration.

Let’s execute our main test case once again (with XSLT transformation).

The test case has been executed correctly. As you can see in the Execution Information input message was mapped by the XSLT program, which is stored in test case 17461.

Using appropriate XSLT mapping, you can solve many issues with differences between XML structures in input/output payloads.

 

 

© 2017 - 2022 Int4 AG All rights reserved