AscentialTest provides a table interface that allows the user to easily get, verify, select and set table elements in the target application. This document provides instructions on how to use that interface to generate the following types of actions:
- Get or verify the contents of a table
- Get or verify the contents of a row
- Get or verify the contents of a column
- Get the number of rows
- Get the number of columns
- Select a row and or column
- Set the value of an element embedded in a column (TextField, PopupList, RadioList, etc.)
The examples in this document use a PowerBuilder data window to demonstrate the AscentialTest table interface, but the concepts described can be generalized to any target application containing a table.
The image below depicts an example table. Notice that it is a PbTable with 126 rows.
Figure 1
For the table called ‘Customers’ as displayed in Figure 1, the metadata has been enabled by clicking the checkbox to the left of ‘CustomersRow’ as shown below in Figure 2. Checking that checkbox provides the mechanism for creating the record to store the contents of a row. It is necessary to use some of the features described below.
Figure 2
Getting the contents of a table
To get the contents of the entire table, use the ‘Get’ radio button in the Actions Panel and select the ‘Value’ property:
Click the ‘Append’ or ‘Insert’ button and the action will be generated in the open step:
Verifying the contents of a table
There are two ways to verify the contents of a table. Which option you choose depends on whether the expected contents of the table will vary.
If the expected contents will vary and you intend to pass in the expected result, use the ‘Get’ action described above and then add a ‘VerifyValue’ action to compare to the expected result:
If the contents of the table will not vary, use the ‘Verify’ radio button in the Actions Panel and select the ‘Value’ property:
Click the ‘Append’ or ‘Insert’ button and the action will be generated in the open step:
The values are captured in an AscentialTest data table. The contents can be viewed by double-clicking on the table icon.
Getting the contents of a row
To get the contents of a row, use the ‘Get’ radio button in the Actions Panel and select the ‘Values’ property. The row can be specified using an index or string selector:
Click the ‘Append’ or ‘Insert’ button and the action will be generated in the open step:
Verifying the contents of a row
To verify the contents of a row, use the ‘Verify’ radio button in the Actions Panel and select the ‘Values’ property. The row can be specified using an index or string selector:
Click the ‘Append’ or ‘Insert’ button and the action will be generated in the open step:
The expected values can be changed or parameterized in the step that contains the verify action.
Getting the contents of a column
To get the contents of a column, use the ‘Get’ radio button in the Actions Panel and select the ‘Text’ property:
Click the ‘Append’ or ‘Insert’ button and the action will be generated in the open step:
One change needs to be made because of a type conversion issue that will be resolved at some point in the future. Here is an easy workaround. Simply cast the return to a List<String>:
Verifying the contents of a column
To verify the contents of a column, use the Actions Panel as described above to generate a ‘Get’ action and then add a ‘VerifyValue’ to compare the actual to the expected results:
Getting the number of rows and columns in a table
To get the number of rows or columns in a table, use the ‘Get’ radio button in the Actions Panel and select either the ‘NumRows’ or ‘NumCols’ property:
Click the ‘Append’ or ‘Insert’ button and the action will be generated in the open step:
Selecting a row in a table
Currently, selection of a row in a table results in the error: AgentScrollException: ScrollBar event failed. This problem will be resolved in an upcoming release of AscentialTest. Please refer to the next topic, ‘Selecting a row/column in a table’, for a workaround.
Selecting a row/column in a table
To select a column in a row, use the ‘Event’ radio button in the Actions Panel and specify the row using either an index or string selector.
Click the ‘Append’ or ‘Insert’ button and the action will be generated in the open step:
Setting the value of a control embedded in a table cell
Table cells often contain input elements like TextField, PopupList, RadioList, etc. The example below displays a PbTextField inside of a PbColumn in a PbTable:
To set the value of an input element in a table cell, use the ‘Set’ radio button in the Actions Panel and specify the row using either a selector or an index.
Click the ‘Append’ or ‘Insert’ button and the action will be generated in the open step:
If the snapshot contained a value in the field to be set, that value will be captured as the input value. The value can either be changed or parameterized in the step where the action has been generated.
If you have any questions about interfacing with tables, please contact Zeenyx Support at [email protected] for assistance.