---
title: "Introduction"
description: "What an expectation is, and why a test has one or two queries"
url: "https://docs.justcat.it/reference/tests/expectations/introduction/"
---
# Introduction


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](https://docs.justcat.it/reference/tests/results/ "Results").


**Properties**



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





**YAML**


```yaml
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](https://docs.justcat.it/reference/tests/expectations/overview/ "Expectations overview") lists every expectation with the number of queries it needs; the rules for the two sets themselves are in [Test properties](https://docs.justcat.it/reference/tests/properties/#first-and-second-sets "First and second sets").

## Names

Expectation names are matched by [naming convention](https://docs.justcat.it/reference/project-file/naming-conventions/ "Naming conventions"): `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](https://docs.justcat.it/reference/tests/expectations/overview/ "Expectations overview") — every expectation, how many queries it needs and when it passes.
* [Test properties](https://docs.justcat.it/reference/tests/properties/ "Test properties") — everything a test definition can carry, expectation-specific properties included.
* [Results](https://docs.justcat.it/reference/tests/results/ "Results") — `Passed`, `Failed`, `Error`, `Inconclusive` and what a result carries.

