Set RowCount
You expect the query returned exactly specified number of rows.
Example
You might for example expect your table contains data of all your 5 departments. To verify that:
Tests:
- Test Name: data of all departments are present
Test Suite: data quality checks
Data Source: HR
Query: SELECT DISTINCT departnemt_id FROM work_records
Expectation: set rowcount
Expected Row Count: 5
You can also specify the expected row count in the Second Query
property. This is especially useful when you load data from a relational database table and you don’t want to have too many columns specific to some expectations. So this syntax would be also valid:
Tests:
- Test Name: data of all departments are present
Test Suite: data quality checks
First Data Source: HR
First Query: SELECT DISTINCT departnemt_id FROM work_records
Second Query: 5
Expectation: set rowcount
Result
If you specify both Second Query
and Expected Row Count
, CAT will get confused and the result will be Error
.
If the number of rows returned by the query is exactly the same as expected, the result will be Passed
.
If the number of rows returned by the query is different, the resutl will be Failed
.