Set is not Empty
You expect the query returned at least one row.
Example
This expectation is useful in smoke tests. E.g., after a release or after every data load into DWH you might want to check that a table is not empty - you expect the process loaded at least “something”:
Tests:
- Suite: Smoke Tests
Name: Table Dimension.Customer is loaded
Data Source: DWH
Query: SELECT * FROM Dimension.Customer
Expectation: set is not empty
Result
If no rows are returned, the result will be Failed
.
If at least one row is returned, the result will be Passed
.
If the underlying provider returns an exception, the result will be Error
.
Remarks
When this expectation is veryfied, CAT closes connection to the underlying provider immediately after it receives first results.
CAT really only checks whether the result contains at least one row and does not examine it in any way. So if your query is
SELECT COUNT(*) FROM SomeTable
and expectation is set is not empty
, the result will be always Passed
, because one row (with the number of records) is always returned.And as with any other expectation, if the query runs too long time, consider using some optimization techniques, such as SELECT TOP(1)
in SQL server, limit 1
in PostgreSQL etc.