Custom Tests
Collate’s built-in tests cover most use cases, but sometimes you need something more specific. You can bring in results from your own test suite or define entirely new tests that run inside Collate — all through the API and the Python SDK. The setup involves five steps:- Create a Test Definition
- Create a Test Suite
- Create a Test Case
- Write Test Case Results
- (Optional) Make the test available in the Collate UI
Step 1: Create a Test Definition
A Test Definition tells Collate what your test is: its name, what entity type it applies to (table or column), and which platforms run it. Send aPOST request to /api/v1/dataQuality/testDefinition with at least the following fields:
Collate in testPlatforms. That requires extra setup covered in Step 5. If you only want to build a UI-executable test, go to Step 5.
Step 2: Create a Test Suite
A Test Suite groups Test Cases together for scheduling and ownership. You can create a new one or reuse an existing suite. Send aPOST request to /api/v1/dataQuality/testSuites/executable:
Step 3: Create a Test Case
A Test Case is a specific instance of your Test Definition applied to a table or column. It uses the fully qualified name (FQN) to reference the test definition and suite. Send aPOST request to /api/v1/dataQuality/testCases:
<> in the entityLink value.
Here is a complete cURL example:
Step 4: Write Test Case Results
Note: This step is optional if you’re running the test through the Collate UI.
PUT request to /api/v1/dataQuality/testCases/{test FQN}/testCaseResult:
Step 5: (Optional) Make Your Test Available in the Collate UI
To make your custom test available in the Collate UI — so anyone can run it without touching the API — wire it up using the Collatedata_quality namespace submodule.
-
Create your namespace package
Start by creating a Python package that holds your test logic. At minimum, your package needs this structure:
Place your test file in the right location based on the entity type:
- Table tests:
metadata/data_quality/validations/table/sqlalchemy/<yourTest>.py - Column tests:
metadata/data_quality/validations/column/sqlalchemy/<yourTest>.py
<yourTest>) must match the test name you used in Step 1. Important: Add an__init__.pyfile to every folder with this line: - Table tests:
-
Create your test class
In your
<yourTest>.pyfile, create a class named<YourTest>Validatorthat inherits fromBaseTestValidator. Optionally inherit fromSQAValidatorMixintoo — it gives you extra helper methods out of the box. Implement therun_validationmethod, which must return aTestCaseResultobject. See a full working example in the OpenMetadata validator source tree — it implements an entropy test end to end. -
Install your package
Once your package is ready, install it in the same environment where the Collate Python SDK is installed:

