"SET_LIST" Command

Description: This command is used to generate a 2-dimensional list of data from a data set, a CSV file, an XLS file, or an SQL data base. It is also capable of splitting a string into parts and creating an empty list.

  • The + icon in Advanced Filters allows you to add “Include” or “Exclude” rules which work by Name or Owner. You can use these rules to include or exclude certain data from appearing on your list.

  • The “Use '1' as column and row starting index” can be used if you would like to reference the fields starting from column and row number 1, otherwise the default will be 0.

image-20240527-164131.png

The preview list button allows you to view your list (for Data Sets source type) before executing your test case. For other sources, you can run your test and click … in the Variables pane on the right.

image-20240527-164319.png

 

Usage Scenarios:

Row

Email

Password

0

Email1@gmail.com

Password1

1

Email2@gmail.com

Password2

2

Email3@gmail.com

Password3

3

Email4@gmail.com

Password4

4

Email5@gmail.com

Password5

 

(Scenario 1) Using the table above, suppose we want to fill the values from Row 3 / Column 2 = “Email3@gmail.com” in the Email address text box on Reference app.

Procedure:

A- Create a data template and copy the data from the table above into data sets. After that, create an automated test case and use Set_List command to generate the list from the data set.

B- Create steps that navigate to Reference app and click on the Login link.

C- In the Fill step, define a locator for the Email address text box. In the Value field, use the formula below.

@list_variable[row.number][column.number]

Your steps should look like this:

 

The video below shows the steps in this scenario:


(Scenario 2) Suppose we want to loop through all values from the table into the Email address text box on Reference app.

Procedure:

A- Create an automated test case and use Set_List command to generate the list from the data set.

B- Create steps that navigate to Reference app and click on the Login link.

C- Add a Loop step with the following parameters:

Start 0 End @list_variable.rowsCount-1 Step 1

NOTE: list_variable is the variable defined in step A.

NOTE: “rowsCount-1” will take existing data from rows

D- Add another loop step with the following parameters:

Start 0 End @list_variable.columnsCount-1 Step 1

NOTE: list_variable is the variable defined in step A

NOTE: “columnsCount-1” will take existing data from columns

E- Add a Fill step that fills the formula below into the Email address text box. For easier readability, add a space after this line or a slash or any character your like.

F- Add two Loop_End steps to finish the loop. Your steps will look like this:

The video below shows the steps in this scenario:


(Scenario 3) Suppose we want to loop through all rows from Email column and fill the values into the Email address text box on Reference app.

Procedure:

A- Create an automated test case and use Set_List command to generate the list from the data set.

B- Create steps that navigate to Reference app and click on the Login link.

C- Add a Loop step with the following parameters:

NOTE: list_variable is the variable defined in step A

NOTE: “rowsCount-1” will take data from existing rows

D- Add a Fill step that fills the formula below into the Email address text box. For easier readability, add a space after this line or a slash or any character your like.

E- Add a Loop_End steps to finish the loop. Your steps will look like this:

The video below shows the steps in this scenario:


(Scenario 4) Suppose we want to retrieve a list of names from a post on Reference app and split this string into parts.

Procedure:

A- Create an automated test case and add steps that navigate and log into Reference app.

B- Create a step that retrieves the text of the post using Get_Web_Value command and assigns it to a variable name. If the post is not existent, you can create one and define a locator using XPath. For example, the names you can use are:

C- In a new step, use Set_List command and select Split String as Source Type.

D- In the Text to split filed, enter the variable from step B preceded by @.

E- In the Splitters field, select the appropriate type and character. If the above example is used, we must check Comma field.

F- Your steps will look like this. Run the test to see how it will retrieve the string and split it into parts.


(Scenario 5) Suppose we have data in a database that we want to retrieve and loop through them using the query:

Procedure: Define a step with Set_List to generate the list from the SQL database. Once finished, define steps to navigate to Reference, loop steps and a step that fills the data from the loop into the Email address field. Your steps will look like this:

Loop steps details:


Scenario (6): Suppose we want to create an empty list and add 1 column and row, then add 2 users to it.

Procedure: Define a step with Set_List and select Empty. Then using Modify_List command, you can start adding columns and rows and modifying them accordingly.

Step Order:

1- Set_List HALT list EMPTY Creates an empty list

2- Modify_List HALT @list ADD_COLUMN Adds a new column to the list

3- Modify_List HALT @list ADD_ROW Adds a new row to the list

4- Modify_List HALT @list MODIFY_VALUE Modifies existing Row/Column by adding value

5- Modify_List HALT @list ADD_ROW Adds a new row to the list

6- Modify_List HALT @list MODIFY_VALUE Modifies new Row by adding value

 

 

 

 

 

 

Related pages