While you’re developing a flow, you can test the mapping and transformation of data values in an action’s fields and can test the behavior of an action on its associated application.
This helps you verify the correct behavior of the flow while developing, before you deploy the flow for general use.

Testing the mapping and transformation of data values for an action

You can test the mapping and transformation of data values for an action by using sample data, either to test an individual data mapping, or to test multiple data mappings in one or more fields such as when preparing to test the action on its associated application.

Information
  

Testing the mapping and transformation of data values for an action only affects the values shown in the sample data under fields in the flow editor; for example:

Sample data under a field showing values from test data. (Click image to view full size.)
  1. Open the ‘Context and sample data’ pane, which you use to specify sample data to use in tests. You can open the ‘Context and sample data’ pane in several ways:
    • Click the ‘Context and sample data’ icon to the right of the action name.
    • Click in a field, and then click the Edit link in the sample data below the field. (This opens the pane and selects the sample data field for the first mapping in the action’s field.)
    • Click a data mapping in a field, and then select Edit sample data from the menu. (This opens the pane and selects the sample data field for the selected mapping.) For example:
      (Click image to view full size.)
    Context and sample data pane, opened from an Email data mapping
    Context and sample data pane, used to enter sample data to be used to test data mappings (Click image to view full size.)
  2. In the ‘Context and sample data’ pane, enter values that you want to use to test data mappings.
    Changes that you make to the sample data are reflected in real time as you enter values, and will persist while the flow editor is open.

  3. To see the result of your changes to the sample data, look at the sample data below the action’s fields.
    If you’ve applied JSONata functions to the mapping, the sample data is transformed to show the result of those functions.
    For example, in the following image see the test data entered in the ‘Context and sample data’ pane and the effect of the data mapping and JSONata functions displayed in the sample data under the action’s fields:

    Context and sample data pane, showing test data and the effect on data mapping (Click image to view full size.)

Testing the invocation of an action on its associated application

You can test the effect of an action on its associated application by invoking the action with sample data and examining the test result returned by the application.

Attention
  

Testing an action in this way attempts to complete the action on its associated application. Before testing, verify that the account configured on the action is
appropriate for testing use; if needed, you can select an account for testing and then after testing select another account to use when deploying the flow.

You can test the following actions in your flow:

  • All actions for applications that you have configured accounts for on the Applications tab of the App Connect catalog; for example, Salesforce / Create lead
  • Any API that you have connected to on the APIs tab of the App Connect catalog
  • The Log action on the Toolbox tab.

To test such an action, you only require the following conditions:

  • For actions that require an account, ensure that an appropriate account is connected; for example, your Salesforce developer account.
  • Make sure that the authored action is valid with no validation errors, such as missing required fields.
When the above conditions are met, the Test button is enabled:
(Click image to view full size.)
  
Before testing an action, you should consider configuring your own values for the sample data to be used to test the action; otherwise, default sample data will be used for testing.
For example, click the ‘Context and sample data’ icon to the right of the action name, and then in the ‘Context and sample data’ pane enter your own values for the sample data.

To test the action with its data mappings and the sample data values, click the Test icon to the right of the action name, as shown in the following image.

(Click image to view full size.)
Eventbrite / New attendee event to Salesforce / Create lead action with edited sample data
When the action is completed, a test result is returned from the application, which you can see under the Test icon in the App Connect flow editor; for example:

(Click image to view full size.)

If you want to see the detail of the test action result, you can click View details; for example:

(Click image to view full size.)
Salesforce / Create lead action test success result

You can copy the output details by clicking the Copy icon . For example, if some of the details are not visible in the ‘View details’ dialog, you can copy the details and paste them into a text editor.

Resolving errors

An action might fail with an error when invoked on its associated application. In that case, the test result will show a “Failed” result, and the details will give more information; for example:
(Click image to view full size.)
Salesforce / Create lead action test failure result

Example scenario: Using the Test action feature for a ServiceNow incident tone analyzer

In this example scenario, when a new ServiceNow incident is raised, App Connect is to send a notification to some recipients. There are some rules to be applied when it comes to notifying about a new incident,
to give priority to those incidents that require urgent attention.

  • If the incident is deemed to have a negative tone above some threshold, send a Slack message to notify the SRE team of the incident.
  • Otherwise, send the operations team an email with details of the incident.

In the flow, App Connect can invoke the IBM Watson Tone Analyzer application to analyze the tone of the new ServiceNow incident, to determine whether the incident is a high priority.
While developing the flow, we can use the Test action feature to experiment with some sample data to have confidence in the mappings and determine the tone thresholds that we want to use.

We’ve added the IBM Watson Tone Analyzer / Get tone analysis action to the flow, and are editing it having configured the Text field to map data from the ServiceNow incident that will trigger the flow.

Event-driven flow with ServiceNow / New incident event and Watson Tone Analyzer / Get tone analysis action

We click the ‘Context and sample data’ icon to the right of the action name (‘Get tone analysis’),
and set some sample data values that represent the type of incidents that we want to analyze and determine a tone score for. Here’s an example of setting a value that’s likely to drive a negative score:

(Click image to view full size.)
Edited sample data for the ServiceNow / New incident event to be passed by data mapping in the Watson Tone Analyzer / Get tone analysis action

When we click the Test icon, we see the tone score returned from IBM Watson Tone Analyzer. In this example, the test generated mostly sadness and anger – tones associated with negative comments.

(Click image to view full size.)
Watson Tone Analyzer / Get tone analysis action test result

We can then perform further tests of the action to understand what is a good threshold to trigger a notification message in Slack.

We can also use the Test action feature to check that App Connect sends Slack messages that contain the right amount of information for the SRE team to investigate.
We create the necessary mappings and update the sample data to represent the inputs for those mappings.

(Click image to view full size.)
ServiceNow / New incident event to Slack / Create message action with edited sample data

We click Test to invoke the ‘Create message’ action, then check for the Slack message in the connected Slack account.

(Click image to view full size.)
Slack / Create message action test result
The message in Slack shows that the action worked, and we can compare the message content to the data mapping in the flow to verify that the behavior is as we want.

Join The Discussion

Your email address will not be published. Required fields are marked *