# Test Coverage Plans Baseline: 51.0% total statements (2026-10-03, after PRs #41-#43). Scope: pgsql, sqlexec, template, plus non-reader/writer packages. Other readers/writers deferred. ## Order | # | Plan | Package(s) | Now | |---|------|-----------|-----| | 1 | [pgsql.md](pgsql.md) | readers/pgsql, writers/pgsql, pkg/pgsql | 16.0 / 74.0 / 87.8 | | 2 | [sqlexec.md](sqlexec.md) | writers/sqlexec | 19.4 | | 3 | [template.md](template.md) | writers/template | 8.5 | | 4 | [models.md](models.md) | pkg/models | 20.4 | | 5 | [cmd.md](cmd.md) | cmd/relspec, pkg/jobs | 49.3 / 72.0 | | 6 | [ui.md](ui.md) | pkg/ui | 3.8 | | 7 | [diff-merge.md](diff-merge.md) | pkg/diff, pkg/merge | 65.5 / 75.1 | | 8 | [sqltypes.md](sqltypes.md) | pkg/sqltypes | 67.0 | ## Conventions - Same package as code under test; table-driven; must pass `-race`. - Existing data first: `tests/assets/*`, `examples/*.dbml`, `tests/postgres/init.sql`, `tests/postgres/issue21`. Generate new data only where listed under "Data needed". - New fixtures go in `tests/assets//` or package `testdata/`. - Live-DB tests: skip unless the env var is set (pattern in `pkg/readers/pgsql/reader_test.go`). Use `tests/dbtest/dbtest.sh` (podman/docker; see `tests/dbtest/README.md`): - `dbtest.sh up|down ` - `eval "$(dbtest.sh env postgres)"` sets `RELSPEC_TEST_PG_CONN` (mssql: `RELSPEC_TEST_MSSQL_CONN`, mysql: `RELSPEC_TEST_MYSQL_CONN`) - `dbtest.sh test [pkgs]` runs up, `go test`, down - Fixtures for live DBs: postgres `tests/postgres/init.sql`, mssql `test_data/mssql/test_schema.sql`, mysql `tests/dbtest/init/mysql.sql`. - Prerequisite: working container networking (currently blocked until reboot into matching kernel; `tun` module). - Prefer pure-function tests over DB tests wherever the logic can be isolated. - Output assertions must not depend on map order (see memory: map iteration determinism). ## Targets | Package | Target | |---------|--------| | pgsql (all three) | >= 85 | | sqlexec | >= 80 | | template | >= 85 | | models | >= 80 | | cmd/relspec | >= 65 | | jobs | >= 85 | | ui | >= 40 (data ops/pure helpers; screens via smoke tests) | | diff, merge | >= 85 | | sqltypes | >= 85 | ## Verify - `go test -race -coverprofile=c.out ./pkg//` then `go tool cover -func=c.out` - `make test` before commit