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
- Testing the invocation of an action on its associated application
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.
- 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:
- 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.
- 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:
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.
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.
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.
If you want to see the detail of the test action result, you can click View details; for example:
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.
Example scenario: Using the Test action feature for a ServiceNow incident tone analyzer
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.
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:
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.
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.
We click Test to invoke the ‘Create message’ action, then check for the Slack message in the connected Slack account.