How to test iFlow with SFTP Adapter on SAP CPI
When SFTP Adapter is used, there is no possibility to locate test message using Application ID or Correlation ID. Test message needs to be identified using payload check. To locate the message with correct payload Int4 Suite is using Variables. Variable needs to contain configuration that will generate new value and will use this new value to locate the correct test message.
In above example three mandatory steps are configured:
a) Read - selecting field that will contain new value in a input message
b) Replace - define how new value will be generated. It can be any of available engines that generates unique values, for example Number Range, Random Value, GUID, etc.
c) Find - define output field that should be used to locate test message
Â
Â
How to leverage CPI Header to find message?
In the situation where it is not possible to find messages using payload content you can use SAP CPI Header data. For this purpose:
Enable CPI: Read CPI Headers parameter in the Automation Object
Once you will save the test case - it will contain additional output payloads with the SAP CPI Header, example:
Â
Create variable that will read content of the specific field in the message header, e.g. CamelFileName
Â
Alternatively if you don’t want to compare SAP CPI Header - add the following payload validation entry:
Â
Execute the test case and confirm that the SFTP file is injected to the SFTP and that Int4 Suite finds message based on the header data.
How to leverage CPI Header to find message using unique file name?
In order to make sure that the file name created by Int4 Suite in the tested SFTP has always a unique value - follow the instructions below.
Turn on the validation of the CPI Headers - follow the previous section.
Create the variable that will always generate a random number for new test message and use this value to find the message based on the Cloud Integration Message headers.
Add a new entry in Parameters section for the HTTP Header with value Int4FileName={<NAME_OF_THE_VARIABLE>}
Optionally add a delay between the test case execution and validation (it should match the number of seconds set in the SFTP sender adapter for pooling in the tested iflow )
Â
Execute the test case. Int4 Suite should find the message with the new file name
© 2017 - 2022 Int4 AG All rights reserved