Working with Tables

Working with Tables

testRigor drastically simplifies the process of working with tables. Let’s look at the example below:

Actions
# ID Name Ship Status Actions Additional Data
Filter by N/A
101 york1 Yorktown Enterprise Alright Arrive Cancel
102 spk2 Spock Enterprise Alright Listen to Ignore
103 nyo3 Nyota Enterprise Alright Open channel Promote
104 spk2 Spock Kelvin Alright Listen to Ignore
105 nyo3 Nyota Kelvin Alright Open channel Promote
Refer to table cells by the intersection of the row and column and produce the value of the first cell in a row and the value of the header or top cell in the column. Let’s click on Open Channel:
click table "Actions" at row "103" and column "ID"
You can also specify row by saying that row should contain a certain value. This way testRigor will check all values at every row to find a match. For example, for the same table above, and command:
click table "Actions" at row containing "spk2" and column "Ship"
will result in a click on the first action “Listen to”. To click on the second action “Ignore” you can leverage our context feature:
click "Ignore" in the context of table "Actions" at row containing "spk2" and column "Actions"
You can also work with multiline headers by referring to them wither “header” word:
enter "york1" into first table at the second header row and column "ID"
testRigor supports tables for all kinds of operations including but not limited to: validations (checks), clicks, hover, entering data (enter … into), drag and drop, etc. Examples:
check that table "Actions" at row "102" and column "Name" contains "Spock"
check that table "Actions" at row "101" and column "Additional Data" has value "Looks like a trap"
enter "This is a trap!" into table "Actions" at row "101" and column "Additional Data"
click "Open channel" within the context of second table at row "103" and column "Actions"
check that the second table at row containing "Nyota" and column "Actions" contains link "Open channel"
click the first button within the context of second table at row containing "Nyota" and column "Actions"

Keep in mind that there are many different types of tables, and at some point you might need to deal with some which are internally not a table but look like one.

If that’s the case and the test fails – you should use relative locations instead.

Dealing with tables with SQL-like language

You can refer to elements of the table by specifying row and column. And to specify a row there is a powerful SQL-like language available. For example, you can say things like:
click "Delete" inside of table at row containing "my unique id" and column "Actions"

Here we didn’t specify the column where the “my unique id” should reside, but rather indicated that it could be in any column at that row.

You can also construct SQL-like expressions containing one or multiple columns with different validations. For example:
check that table with "Country" equal to "United States" and "City" equal to "Saint Petersburg" and "State" equal to "Florida" at column "Status" contains "Flourishing"
Here we used 3 different conditions to identify the row connected with the boolean operator AND. The following boolean operators are supported:
  • AND
  • OR
  • NOT
  • Brackets ()
and you can also use brackets. The condition calculation will follow the standard boolean logic. The condition above could also be expressed like so:
check that table with not("Country" not equal to "United States" or "City" not equal to "Saint Petersburg" or "State" not equal to "Florida") at column "Status" contains "Flourishing"

You can learn more about how boolean operators work here.

Test your knowledge

click “Listen to” next to table “Actions” at row “spk2” and column “Actions”
click “Listen to” below “Listen to” within table “Actions”
click “Listen to” near the context of table “Actions” at row “spk2”
click “Listen to” in the context of table “Actions” and on the right of “104”
click “Listen to” inside table “Actions” after “spk2”
enter “This is easy” into table “Actions” at row “105” and column “Additional Data”
enter “This is easy” into table “Actions” in last row and column
type “This is easy” into “Actions” table in last row and column “Additional Data”
enter “This is easy” into first table under header “Additional Data”