Skip to main content

Module test

Module test 

Source
Expand description

Test command — run unit tests against the database.

Executes EXECUTE UNIT TEST statements attached to project objects against a Materialize instance spun up in Docker. The pipeline:

  1. Load — Compile the project and optionally load/generate type metadata.
  2. Filter — Select tests matching the user’s filter pattern (supports database.schema.object#test_name with wildcards at any level).
  3. Connect — Establish a database connection to the target environment.
  4. Execute — For each test: locate the target view, desugar the test into SQL, execute setup statements, run the assertion query, and classify the result.
  5. Report — Print pass/fail output and, when requested, produce a JUnit XML report.

§Outcome Classification

  • Passed — Assertion query returned zero rows (no mismatches).
  • Failed — Assertion query returned rows (missing or unexpected data) or a runtime error occurred during execution.
  • ValidationFailed — Test definition is invalid (bad target, malformed AT TIME, etc.). Tracked separately so summary output distinguishes broken definitions from runtime failures.

Functions§

run