Use "Property: For Each" with an Array of Values from a Response

In the first example, a test composition with two test clips is presented. The "First Clip" contains a single message that will receive an array from the server as a message response, while the "Second Clip" will repeat one time for each value that is received. Note that the "First Clip" has scope local set. The "Second Clip" is set to repeat using "for each".

The "First Clip" has a custom clip property, Received count.

Additionally, there are five output values in the message.

The xpath automatically generated by CloudTest to match the single value1 response field was edited manually to create an xpath that matches more than one value. In the example xpath shown on the right, any item under "out" will be matched. This will cause the Received count custom property to automatically be an array. In this case the array will contain the five returned values (e.g. value1 through value5).

The "Second Clip" has two messages and those messages each include a substitution of the original response value for which the current iteration of the Clip is being repeated. The clip will be executed five times, one for each value, and the clip and its elements have access to the value for which it is being executed each time.

In the Composition Editor, the "Second Clip" is set to use "Property: For Each" as shown on the right. The path {%% prop : track : First Clip/Received count %%} has been used to get the value of the Received count custom property in "First Clip".

When the test composition is played, the "First Clip" will run and the message in it will cause the Received count property to be set to an array of values. The "Second Clip" will run one time for each value in that array.

In the Input/Output list, the First Clip's message response is shown.

In the Events List, the value (Array) is shown. The detail for a given array is not shown in results (since it could be prohibitively long).