Set an index, notation or result count

Depending on your payload, you can specify a list entry in one of three ways:

  • Set an index on the XTestStep to verify a specific list entry.

    You can use an index on the whole list, rather than setting ActionMode Constraint on individual elements.

    Use this option if your list consists of name-value-pairs (see example below).

  • Set a notation to verify a specific list entry.

    Unlike the index, the notation is added to the name field of individual XTestStepValues. This enables you to use both values and notations.

    Use this option if your list consists of values (see example below).

  • Set a result count to verify how many times a specific list entry appears in a list or how many attachments a response contains.

    The result count is added in the value field of the individual XTestStepValues (see example below).

Set an Index

To set an index, follow the steps below:

  1. Go to your XTestStep and select the parent item.

  2. In the Value drop-down menu, enter one of the following values:

    • Index == <result>

    • Index == Last to verify the last item on the list.

  3. Set the ActionMode to Verify.

Work with Index

In this example, you work with a list that contains three entries:

List in the payload

The index below verifies that entry number 2 on the list contains the following:

  • Value 2 for Id

  • Value Starbucks Main Station Vienna for Name

  • Value Vienna for City

  • Value Austria for Country

Use an explicit index

The index below verifies that the last entry on the list contains the following:

  • Value 3 for Id

  • Value Café Hawelka for Name

  • Value Vienna for City

  • Value Austria for Country

Use index Last

Set a notation

You can use a notation on the XTestStep to verify a specific list entry. This notation has to begin with $.

To set a notation, follow the steps below:

  1. Go to your XTestStep and select the respective XTestStepValue.

  2. In the Name field of this XTestStepValue, specify the list entry. There are two ways to do so:

    • To specify the number of the list entry to be verified, enter $ and the respective number.

    • To verify the first or last entry on your list, enter $first or $last.

  3. From the Value drop-down menu, select the value that you want to verify.

  4. Set the ActionMode to Verify.

Add notation and value

In this example, you work with a list that contains multiple entries:

List in the payload

The notations below verify the following:

  • The value for list entry number 1 is apple.

  • The value for list entry number 4 is strawberry.

  • The value for the last entry on the list is pear.

Use notations

Set a result count

You can use result count to verify how many times a specific list entry appears in a list, or to verify how many attachments a response contains.

To do so, follow the steps below:

  1. Go to your XTestStep and select the respective XTestStepValue.

  2. In the Value drop-down menu, enter ResultCount == <result>

  3. Set the ActionMode to Verify.

Use ResultCount

In this example, you work with a list that contains many entries:

List in the payload

The result count below should verify that the list entry file appears in the list five times.

Set ResultCount

However, the expected value 5 is incorrect and the verification fails. The Loginfo displays the actual value.

Failed verification

The corrected result count below verifies that list entry file appears in the list eight times.

Use ResultCount