Use to select rows to run the test case against. You use this dialog box to build queries that run against your data-driven test case.
Click Specify Rows on the Run Testcase dialog box or the Testplan Detail dialog box.
You cannot run using the sample record for individual tables. In order to run using the sample records for each table used by the test case, for example to do a quick test or if you are not connected to the database, click Use Sample Data from Script on the Run Testcase dialog box.
When you select rows on a table-by-table basis, you use 'AND' and 'OR' actions. These may be used only to specify multiple conditions for a single table. You cannot include more than one table in a single 'where' clause. Conditions on separate tables must be specified independently, by selecting each table in the 'Table' list separately. The number of test cases that runs is:
# of rows selected for Table 1 X the # of rows selected for Table 2 X the # of rows for Table 3
The where clause of a query has the form:
(<Column> <relational operator> <value>) [and|or] (<Column> <relational operator> <value>)...
select * from <tablename> where the first list contains a list of columns from the table selected above.
where (the second list) lists the following relational operators that apply to all column types:
To indicate | Select |
---|---|
Equals | = |
Not equal to | <> |
Greater than | > |
Greater than or equal to | >= |
Less than | < |
Less than or equal to | <= |
Like (typically used with STRING columns) | like |
There are three additional relational operators that you can type into the Editable query area – but they do not appear in the where dropdown.
To Indicate | Type |
---|---|
Between two values (value1 <= value <= value2) | between <value1> and <value2> |
In a set of discrete values | in (<value>, <value>, <value>) |
Not in a set of discrete values | not in (<value>, <value>, <value>) |
All string values must be enclosed in single quotation marks, for example, 'value'. For string columns, you can match a pattern by using like ‘pattern’. The pattern can contain the single character (_) wildcard or the 0 or more characters (%) wildcard.
If a column allows NULL values, then you can use the following query to return only those rows for which the column contains a value:
select * from table_name where column_name <> NULL
Similarly, the following query would return only those rows for which the column is empty:
select * from table_name where column_name = NULL
The following table shows several sample queries and their corresponding "where" clause.
To find | Use this WHERE clause |
---|---|
adults whose first names begin with 'B' |
(FirstName like 'B%') and (Age >= 18) |
bananas, cherries, apples, or any type of berry |
(Fruit in ('banana', 'cherry', 'apple')) or (Fruit like '%berry') |
people born in the 1960's with 3-letter last names |
(YearOfBirth between 1960 and 1969) and (LastName like '___') |