Adding elements to an array

In addition to using expressions, ranges, sets, and objects in test data tables, you can also use one-dimensional and multidimensional arrays. Arrays are displayed hierarchically in the test data table with each element in the array appearing in its own row, nested beneath the row that represents the array.

Array elements can consist of any data type, even complex object data types. Each element in the array is displayed with its index and can be retrieved and changed independently.

To add an element to an array:

  1. In a test data table, right-click a row that contains an array and click Add Child Element. A new row is added to the test data table for the new array element with an index of [0].

  2. To add additional array elements, right-click any row that contains an array element and click Add element.

  3. Supply the table with test data.

 

Example: Two-dimensional array

Here is a portion of test behavior code and test data table for a two-dimensional array:

Code and test data table with two-dimensional array

 

Related concepts

Test data tables

 

Related tasks

Using a subclass to initialize and test an object
Supplying test data for the attributes of object data types