Introduction
The expectation is the part of a test definition that says what has to be true about the data.
On this page
Every test definition — wherever it is stored — has an Expectation. CAT runs the test’s query (or queries), looks at what came back, and evaluates the expectation: the test is Passed when it holds and Failed when it does not. If something goes wrong before the expectation can be evaluated — a data source that does not exist, a statement the provider refuses, a timeout — the result is Error. See Results.
Tests:
- Name: Dimension Currency is not empty
Suite: Smoke tests
Description: After every load the Currency dimension must hold rows; an empty table means the load did not run.
Data source: DWH
Query: SELECT * FROM Dimension.Currency
Expectation: set is not empty
One set or two
An expectation works on one set of data or on two. Set is empty, set is not empty and set row count look at one set — the test has one Data source and one Query. Sets match and contains compare two sets — the test has First data source + First query and Second data source + Second query. The two sets may come from two different data sources, in two different technologies: SQL Server against PostgreSQL, Oracle against a Power BI semantic model.
A one-set expectation refuses second-set properties — a Second data source or Second query on such a test ends it with Error. The one exception is set row count, which reads the number of rows it expects from Second query. The Overview lists every expectation with the number of queries it needs; the rules for the two sets themselves are in Test properties.
Names
Expectation names are matched by naming convention: set is not empty, Set Is Not Empty, SET_IS_NOT_EMPTY and SetIsNotEmpty are all the same expectation. The reference pages use the lower-case, spaced form.
Related
- Overview — every expectation, how many queries it needs and when it passes.
- Test properties — everything a test definition can carry, expectation-specific properties included.
- Results —
Passed,Failed,Error,Inconclusiveand what a result carries.