Testing Nodes

You’ll need to create a SQL SELECT statement to test nodes. If the results match any of the data in the node’s columns, the test will fail. Let's go through a simple example with Snowflake sample data to demonstrate.

Node tests can be run before or after the node's transformations. You can set the run option in the Node test.

Example Node Test

The column C_NATIONKEY is an integer that corresponds to a specific country, and we know that this number must be positive. No countries in the data set should have a negative number, so we will test for this.

  1. Click on Testing.
  2. Click on New Test in the Node section to create a new test.
  3. In the text box, type in SELECT * FROM {{ ref_no_link('TARGET','STG_CUSTOMER')}} WHERE C_NATIONKEY < 0 but make sure to replace TARGET with the name of your storage mapping.
  4. Uncheck the Continue on Failure toggle.
Example Node Test

Example node test

  1. Run the node, it should succeed. You can confirm by opening the Results pane and seeing the different stages.
Example successful node test results

Example successful node test results

  1. Try reversing the < to >, which will match all of our records (nation keys are all positive integers). This will cause the test to fail and the node's data will not be processed.

📘

Before or After?

Node tests can be run before or after the node's transformations, and this is user-configurable.