Set is Empty
You expect the provided query didn't return any results.
Example
This expectation is simple and self-explanatory - you expect the provided query didn’t return anything.
For example, if you log errors into a table and you need an automated way to check no errors are being added:
Tests:
- Suite: Smoke Tests
Name: Table dbo.Errors is empty
Data Source: DWH
Query: SELECT * FROM dbo.[Errors]
Expectation: set is empty
Result
If no rows are returned, the test result will be Passed
.
After reading at least one row, CAT marks the test as Failed
.
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 result(s).
SELECT COUNT(*) FROM SomeTable
and expectation is set is empty
, the result will be always Failed
, because one row (with the number of records) is always returned - regardless whether the table has rows or not.If the table or view you are testing might be huge (well, you don’t expect that, but if under some circumstances might be), consider some optimization techniques. The syntax depends on the underlying provider. If you are not experienced, try to search for e.g., “best way to check table is empty in ORACLE”.