Skip to main content

Tests object schema

Tests are assertions you make about your models and other resources in your dbt project. When you run dbt test, dbt will tell you if each test in your project passes or fails. You can query tests through the Discovery API to understand information about them.

The Example query illustrates a few fields you can query with the tests object. Refer to Fields to view the entire schema, which provides all possible fields you can query.

Arguments

When querying for tests, you can use the following arguments:

Fetching data...

Example query

You can use the environmentId and filter by test types to return metadata for all tests in the environment:

query {
environment(id: 834) {
applied {
tests(
filter: {
testTypes: [
GENERIC_DATA_TEST,
SINGULAR_DATA_TEST,
UNIT_TEST
]
},
first: 100
) {
edges {
node {
name
model
description
expect
resourceType
testType
given
}
}
}
}
}
}

Fields

When querying for tests, you can use the following fields:

Fetching data...

Key fields from nodes

Fetching data...

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

0