Work with dynamic lists

The API Engine 3.0 supports two types of XML and JSON lists. Before you add your Module Attributes, consider which kind of list you want to create.

  • Dynamic list: a list that contains one Module Attribute with multiple values.
    Use a dynamic list, if you have a list with multiple items but you only want to work with a few of them in the payload. For example, if your list contains thousands of items and you only want to create Module Attributes specifically for the first and the last one.

  • Static list: a list that contains one Module Attribute for each list item.

    Use a static list, if you have a list with multiple items and you want to have all of them in the payload. For example, if your list contains thousands of items and you don't want to create all Module Attributes manually.

By default, the API Engine 3.0 creates a dynamic list when you add Module Attributes for the first time.

However, if you have already created a list with Module Attributes, the API Engine continues to add the same kind of Module Attributes. This means the following:

  • If you have already added dynamic Module Attributes, the API Engine continues to add dynamic Module Attributes.

  • If you have already added static Module Attributes, the API Engine continues to add static Module Attributes.

The default list type is specified in the property ListSupport whose value indicates whether a list is Static or Dynamic.

Switch from static to dynamic list

If you want to convert a static list into a dynamic list, follow the steps below:

  1. Delete all static Module Attributes.

  2. Open the Add drop-down in the API Testing menu and select Add Module Attribute(s) with Dynamic List Items.

    Alternatively, you can change the ListSupport property manually from Static to Dynamic and simply click Add.

Add Module Attributes

You can now add Module Attributes to create a dynamic list.

Create dynamic list items

When you add dynamic Module Attributes for XML and JSON lists, the Attribute Assistant performs the following actions:

  • It merges similar Module Attributes that appear more than once, e.g. an ID or name.

  • It adds a parent item and one Module Attribute with multiple values.

  • The parent item gets a Cardinality of 1-N, which allows you to create any number of XTestStepValues.

  • It removes inactive nodes in requests by default.

  • It creates the property ListSupport with the value Dynamic.

  • It sets the ActionMode to Select for the parent item, to Insert for the sub-elements in requests, and to Verify for sub-elements in responses.

Dynamic list Module

Work with dynamic lists

Once you have created the Module Attributes, you can work with your dynamic list TestCase.

Dynamic list TestCase

If you generate a new XTestStepValue for a list item, the value appears in the payload automatically. You can check this in the Technical View of the TestStep.

You can now steer the Module Attributes as you would in static lists. For instance with the ActionModes Verify and Constraint.

You cannot set an index or notation in a dynamic list. To use an index or notation, switch to static list support.