Skip to main content

How to Write and Deploy No-Code Test Cases

OpenMetadata supports data quality tests at the table and column level on all of the supported database connectors. OpenMetadata supports both business-oriented tests as well as data engineering tests. The data engineering tests are more on the technical side to ascertain a sanity check on the data. It ensures that your data meets the technical definition of the data assets, like the columns are not null, columns are unique, etc. There is no need to fill a YAML file or a JSON config file to set up data quality tests in OpenMetadata. You can simply select the options and add in the details right from the UI to set up test cases. To create a test in OpenMetadata:
  1. Navigate to the table you would like to create a test for. Click the Data Observability tab.
  2. Click Add Test to select a Table or Column level test. Write and Deploy No-Code Test Cases

Table Level Test

To create a Table Level Test enter the following details:
  • Name: Add a name that best defines your test case.
  • Test Type: Based on the test type, you will have further fields to define your test.
  • Description: Describe the test case. Click on Submit to set up a test.
OpenMetadata currently supports the following table level test types:
  1. Table Column Count to be Between: Define the Min. and Max.
  2. Table Column Count to Equal: Define a number.
  3. Table Column Name to Exist: Define a column name.
  4. Table Column Names to Match Set: Add comma separated column names to match. You can also verify if the column names are in order.
  5. Custom SQL Query: Define a SQL expression. Select a strategy if it should apply for Rows or for Count. Define a threshold to determine if the test passes or fails.
  6. Table Row Count to be Between: Define the Min. and Max.
  7. Table Row Count to Equal: Define a number.
  8. Table Row Inserted Count to be Between: Define the Min. and Max. row count. This test will work for columns whose values are of the type Timestamp, Date, and Date Time field. Specify the range type in terms of Hour, Day, Month, or Year. Define the interval based on the range type selected.
  9. Compare 2 Tables for Differences: Compare 2 tables for differences. Allows a user to check for integrity.
Configure a Table Level Test

Column Level Test

To create a Column Level Test enter the following details:
  • Column: Select a column. On the right hand side, you can view some context about that column.
  • Name: Add a name that best defines your test case.
  • Test Type: Based on the test type, you will have further fields to define your test.
  • Description: Describe the test case. Click on Submit to set up a test.
OpenMetadata currently supports the following column level test types:
  1. Column Value Lengths to be Between: Define the Min. and Max.
  2. Column Value Max. to be Between: Define the Min. and Max.
  3. Column Value Mean to be Between: Define the Min. and Max.
  4. Column Value Median to be Between: Define the Min. and Max.
  5. Column Value Min. to be Between: Define the Min. and Max.
  6. Column Values Missing Count: Define the number of missing values. You can also match all null and empty values as missing. You can also configure additional missing strings like N/A.
  7. Column Values Sum to be Between: Define the Min. and Max.
  8. Column Value Std Dev to be Between: Define the Min. and Max.
  9. Column Values to be Between: Define the Min. and Max.
  10. Column Values to be in Set: You can add an array of allowed values.
  11. Column Values to be Not in Set: You can add an array of forbidden values.
  12. Column Values to be Not Null
  13. Column Values to be Unique
  14. Column Values to Match Regex Pattern: Define the regular expression that the column entries should match.
  15. Column Values to Not Match Regex: Define the regular expression that the column entries should not match.
Configure a Column Level Test After the test is created, you can view the test case. The test case will be displayed in the Data Quality tab. You can also edit the Display Name and Description for the test. Column Level Test Created A pipeline can be set up for the tests to run at a regular cadence.
  1. Select the Pipelines tab.
  2. Click Add Pipeline. Set up a Pipeline
  3. Set up the scheduler for the desired frequency. The timezone is in UTC.
  4. Click Submit. Schedule the Pipeline
The pipeline has been set up and will run at the scheduled time. Pipeline Scheduled The tests will be run and the results will be updated in the Data Quality tab. Data Quality Tests If a test fails, you can Edit the Test Status to New, Ack, or Resolved status by clicking on the Status icon. Failed Test: Edit Status
  1. Select the Test Status. Edit Test Status
  2. If you are marking the test status as Resolved, you must specify the Reason for the failure and add a Comment. The reasons for failure can be Duplicates, False Positive, Missing Data, Other, or Out of Bounds.
  3. Click Submit. Resolved Status: Reason
Users can also set up alerts to be notified when a test fails.

Delete and Restore a Test Case

Note: Deleting a test case from a table’s own Data Observability tab is a hard delete. Soft delete and restore are only available from the platform-wide Test Cases list described below.
  1. Navigate to Data Observability > Data Quality, and click Test Cases.
  2. Find the test case and open its row actions menu, then select Delete. Delete option in the test case row menu
  3. The Delete “<name>” Test Case dialog offers two options:
    • Soft Delete (selected by default): Turn off this test case. Restore it later.
    • Permanently Delete: Delete this test case and all its metadata forever. This can’t be undone.
    Choose Soft Delete and click Delete to keep the test case’s execution history and results while turning it off. Soft Delete and Permanently Delete options
  4. Toggle Show Deleted on the Test Cases page to find soft-deleted test cases.
  5. Open the row actions menu on a deleted test case and select Restore, then confirm. The test case becomes editable and resumes on its existing schedule with its history intact. Restore option for a soft-deleted test case
Note: Restoring a test case requires EditAll permission on test cases. Also restore a deleted test case from its own details page, which stays read-only until it’s restored.

How to Set Alerts for Test Case Fails

Get notified when a data quality test fails.