Built-in Testing
Define and run tests inside the database
ReifyDB has built-in testing primitives. Use CREATE TEST PROCEDURE to define reusable setup logic, and CREATE TEST to write assertions against your data using pipeline syntax.
Run all tests in a namespace with RUN TESTS. Each test runs in its own transaction that is rolled back afterward, so tests never interfere with each other or leave behind state.
Built-in Testing
CREATE NAMESPACE IF NOT EXISTS tp;
CREATE TABLE IF NOT EXISTS tp::users { id: int4, name: utf8 };
CREATE TEST PROCEDURE tp::seed_users AS {
INSERT tp::users [{ id: 1, name: 'Alice' }, { id: 2, name: 'Bob' }];
};
CREATE TEST tp::can_query {
CALL tp::seed_users();
FROM tp::users | ASSERT { id > 0 };
};
CREATE TEST tp::can_filter {
CALL tp::seed_users();
FROM tp::users | FILTER name == 'Alice' | ASSERT { id == 1 };
};
RUN TESTS tp | map { name, namespace, outcome, message };