Assign data to API test/component steps

Relevant for: API testing only

This task describes the different ways to link test step properties (both for input properties and checkpoint properties) to data sources .

Manually enter the values

  1. In the canvas, select the test step to assign property values.

  2. In the Properties pane, open the Input/Checkpoints tab .

  3. In the Value cell for the property, enter the value.

    Note: If you are working with a step that uses XML or JSON input, you can also enter the property values using the Text view in the Input section.

    Tip:  

    • If the property value is a string, enter it exactly as you expect it appear (including spaces and special characters.)

    • If you want to use the values from the previous test run, click the Load from Replay button.

Back to top

Link your test step to a data source

  1. In the Data pane, associate a data source with your test.

  2. In the canvas, select the test step for which you want to assign property values.

  3. In the Properties pane, open the Input/Checkpoints tab .

  4. In the Value cell for the property, click the Link to data source button . The Select Link Source Dialog Box (API Testing) opens.

  5. In the Select Link Source dialog box, select the Data source column option. A list of all data sources is displayed.

  6. Select the data source containing your property's data value. A list of all available data columns is displayed.

  7. In the data columns list, select the corresponding column name for your test step property and click OK.

    Tip: Non-unique column names are displayed with a numeric suffix to help you link to the correct column. The column name is not changed in the data source.

    For example, if you link to a table with multiple Price columns, they are displayed as Price1, Price2, Price3...

    The property name in the Input/Checkpoints tab is now displayed with the associated data source name and data source value.

    Note:  

    • You can only link properties to data sources only if the data source is attached in a loop, such as Test Flow or custom loops.

    • Linking a leaf node to a complex XML node is supported only for string type data.

Back to top

Link your test step to another step

  1. In the canvas, select the step for which you want to link a property value.

  2. In the Properties pane, open the Input/Checkpoints tab .

  3. In the Value cell for the property, click the Link to data source button . The Select Link Source Dialog Box (API Testing) opens.

  4. In the Select Link Source dialog box, select the Available steps option. A list of all steps preceding the selected step is displayed.

  5. In the list of available steps, select the step you want to link to the selected property value. A list of available properties is displayed in the right pane.

  6. In the right pane, open the tab containing the property to which to link.

    Note: If you are linking to the output of a previous step, open the Input/Checkpoints tab .

  7. Select the property to which to link and click OK.

    The property value is displayed in the Value column of the input property name with an expression representing the output of the linked step. The canvas also displays an arrow connecting he step property values.

    Note: The Properties pane displays a down arrow next to any property that is set to be used as output data for another step. Click the icon to display a list of all steps linked to the selected property. For details, see Outgoing Links.

Back to top

Link your test step to multiple sources

  1. If necessary, add a data source. For details on adding data sources, see Add data sources to an API test.

  2. In the canvas, select the step for which you want to link a property value.

  3. In the Properties pane, open the Input/Checkpoints tab .

  4. In the Value cell for the property, click the Link to data source button . The Select Link Source Dialog Box (API Testing) opens.

  5. In the Select Link Source dialog box, click the Custom Expression button to expand the expression area.

  6. Create your expression, with any combination of methods. Click Add after linking to each source to add the value to your custom expression: 

    • Manually enter the expression
    • Link to data source values, as described in Link your test step to a data source.

      Note: You can make a custom expression that includes multiple links to data sources.

    • Link to another step's property, as described in Link your test step to another step.

      Caution: If you are entering a custom string, make sure to add the string exactly as you want it to appear, including spaces and special characters.

    • You can use these methods in any order and in any manner as needed to create your expression.

  7. When you are finished entering all values, click OK.

    The custom expression is displayed in the Value column for the property name in the Input/Checkpoints tab exactly as you entered it in the expression area.

Back to top

Link your test steps to a test or user-defined variable

  1. In the canvas, select the step you want to link to a test or user-defined variable.

  2. In the Properties pane, open the Input/Checkpoints tab .

  3. In the Value cell for the property you want to link to a variable value, click the Link to data source button . The Select Link Source Dialog Box (API Testing) opens.

  4. In the Select Link Source dialog box, select the Test variables option. The list of available variables is displayed.

  5. In the list of available variables, select the variable for the link and click OK.

    The value for the selected property is displayed as the expression of the test variable.

Back to top

Data drive the test step

  1. In the Input/Checkpoints tab, click the Data Drive button. The Data Driving Dialog Box opens.

  2. In the Data Driving dialog box, choose a Data provider: Excel or XML.

  3. Select the properties upon which you want to apply data driving: input properties, checkpoints, or both.

  4. If you specified an Excel provider and data-driving for both input properties and checkpoints, specify whether to place the data for both sections in the same Excel worksheet or different ones.

  5. Indicate whether you want to Configure '<loop name>' as a For Each loop using the new data source. This option repeats the steps in the loop frame according to the number of data rows in the Excel or XML data source. If you disable this option, you can manually set the number of iterations via the loop properties. This setting overrides the general loop properties.

  6. Click OK.

  7. UFT One prompts you to confirm the action. Click OK.

    UFT One populates the value column with data expressions. The expressions are preceded by informational icons, indicating read-only status or unmatching data types.

    Note: If your properties are within an array, you must create at least one array element to allow data driving. To add an array element, select the array's parent node and click the Add button . If you do not add at least one element, then the array will not be data driven.

Back to top

Add data keywords

You can use keywords to customize the test run and validation. For example, SKIP omits a property in the request or in the validation.

  1. In the Value column for a step property, do one of the following:

    • Select the property and choose Insert Keyword from the right-click menu.

    • Link to a data source containing the keyword.

    • Type to keyword into the Expected Value column (checkpoints only).

  2. Select the appropriate keyword:

    Input keywords:

    #SKIP# Omits this element from the XML of the request. This is useful for elements of SOAP requests, for which minOccurs = 0
    #NIL#

    Adds a nil=true attribute to the property's XML in the request.

                <name John Doe nil="true"></name>
              

    If the XML element is not nillable, this is reported to the log.

    Checkpoint keywords:

    #EXISTS#

    Verifies that the element is present in the XML response. In this evaluation, the actual value is ignored—it only checks for the presence of a value. This is useful for SOAP response elements, for which minOccurs = 0.

    #NOT_FOUND# Verifies that the element is not present in the XML response. In this evaluation, the value is ignored. This is useful for SOAP response elements, for which minOccurs = 0.
    #SKIP# Informs the run engine to ignore this value when evaluating checkpoints.

Back to top