hands-on lab

Defining and Working With dbt Tests

Up to 1h 15m
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.


When working with data, you want to be sure that specific requirements and standards are satisfied by your data. When transforming and modeling the data, having a tool that automatically tests the output data could be a good solution in order to have high-quality data.

Testing is a core component when working with data, so dbt allows you to test your sources and models. You can use native dbt tests, but you can also define your own.

In this lab step, you will test your dbt sources. You will then create a custom test, and test a model both with native and custom dbt tests.

Learning Objectives

Upon completion of this lab, you will be able to:

  • Understand what tests are and how to work with tests
  • Create custom dbt tests

Intended Audience

  • Data analysts that need to test the dbt output produced
  • Developers that need to create custom dbt tests


To get the most from this lab, you should have basic knowledge of dbt. To get ready, you can use the following labs:

About the author

Learning paths

Stefano studies Computer Science and is passionate about technology. He loves working with Cloud services and learning all the best practices for them. Google Cloud Platform and Amazon Web Services are the cloud providers he prefers. He is a Google Cloud Certified Associate Cloud Engineer. Node.js is the programming language he always uses to code. When he's not involved in studying or working, Stefano loves riding his motorbike and exploring new places.

Covered topics

Lab steps

Understanding dbt Tests
Connecting to the dbt Web IDE
Defining dbt Tests on Sources
Creating a Custom dbt Test
Adding dbt Tests to Models
Performing dbt Tests and Executing the Models