add-integration-testlisted
Install: claude install-skill radimsem/remindb
# Add an integration test
Integration tests live at the repo root in `package remindb_test`, not inside a `pkg/`. They exercise the full pipeline — a real store, real compiler, real MCP transport — against fixtures under `testdata/`. There are two flavors:
| Flavor | File | Use when |
|---|---|---|
| Direct API | `integration_test.go` | Testing compiler / query / store / transformer end-to-end without MCP |
| MCP | `mcp_integration_test.go` | Testing the user-visible tool surface as an agent would call it |
Pick the flavor by the question you're asking. "Does the compiler emit the right shape from this fixture?" → direct. "Does an agent calling `MemorySearch` after `MemoryCompile` see the expected ranking?" → MCP.
## Where it lands
| File | What changes |
|---|---|
| `integration_test.go` *or* `mcp_integration_test.go` | Add a `Test<Scenario>` function |
| `testdata/<scenario-name>/` | New fixture directory (only if existing fixtures don't match) |
Fixture directories are flat namespaces (`testdata/openclaw/`, `testdata/<your-scenario>/`). One fixture set per scenario family; reuse aggressively.
## The two helpers
Both files lean on package helpers — never reach for raw `store.Open` or raw `mcp.NewServer` in a test.
- `internal/testutil.OpenTestDB(t)` — opens an in-memory `:memory:` SQLite store with migrations applied; auto-cleans on `t.Cleanup`. Use for direct-API tests.
- `internal/mcptest.NewEnv(t)` — opens the test DB, wires a default-config server + tracker, co