# Running tests

`jadpo test` owns everything a test run needs, so nothing about it
appears in your source ([Testing](testing.md)). It starts a disposable
local PostgreSQL, from the PostgreSQL programs installed on your machine,
or uses `JADPO_TEST_DATABASE_URL` in CI. It builds one template database
from the migrations and copies it for each test, so tests run in
parallel. `--keep-failed` keeps a failed test's database, and `--kind
route` runs one kind of test. The report lists each failed test with the
failure it got and the one it expected.

The compiler also generates tests from facts it already has:

- every route refuses bad input with `{ field, rule }` details;
- every declared failure reaches the client in the right envelope and
  status;
- no output has a field its type doesn't declare.

They run with your tests, and the report shows them under the route they
test.

Not built yet: `--affected`, which runs the tests a change reaches.
