Adding an SQL Query action to a test
The SQL Query action queries the selected database to verify that its contents match the selected values. As you add this action, you can validate or store the query results.
Ensure that the database resource is properly configured in the Architecture School perspective. For more information about configuring a database resource, see Database resources, connections, and bindings.
You must have a test. For more information about creating tests, see Test Factory. Tests include steps and actions. For more information about test steps and actions, see Test actions.
Selecting a test
Adding an SQL SELECT statement
To return results against the selected database, add an SQL SELECT statement. Data that is returned from the query can be validated once it is retrieved.
Testing an SQL SELECT statement
Before you run the SQL SELECT statement against a selected database, it might be a good idea to test the SQL SELECT statement.
Editing the query results or manually adding data
If you did not run a test query and save the results, you can add data from the Assert tab or Store tab, by using the icons.
If you ran a test query and saved the results, the column headings (and data) are displayed in the Assert tab and Store tab, and the rows, columns, and cells can be edited and arranged by using these same icons above the data. To see what an icon does, hover over it.
- Select any row and append a row to it, insert a row after it, or delete the selected row. You can also move the selected row up or down.
- Select any column and append a column to it, insert a column after it, or delete the selected column. You can also move the selected column left or right.
-
To clear all the data, click Clear Expected Results (
).
Validating query results
To change the validation rules for a cell or column, use the
Assert tab. Column assertion validates that all cells in a column
match the rule for that column. For example, you might want to assert that all cell values
for that column match a certain regular expression. Cell assertion validates that a
specific cell for that column matches the rule set for that cell. You can use both cell
and column validation rules. For example, you might want to assert that all values in the
column contain 4 digits and that a specific cell contains the value
1234.
Storing the return value in to a tag
You can store the values in a tag, either as a list or as a single value. When you edit a column, all the values for that column are stored in the specified tag as a tag list. When you edit a cell, a single value for that cell is stored in the specified tag. For more information about storing data in to a tag, see The Field Editor.
To store the values for a column or the value for a cell in a tag for later use, use the Store tab. For example, you might want to set the value of the tags in the test to the values of each column in the data source.

In addition, cells with no enabled Store actions are shown in gray.












