Go API testing patterns -- httptest setup, table-driven tests with subtests, test helpers, middleware testing, dependency injection with interfaces, database isolation, parallel tests, testify assertions, golden files
98
98%
Does it follow best practices?
Impact
99%
1.06xAverage score across 5 eval scenarios
Passed
No known issues
{
"instruction": "Write tests for a Go API that uses SQLite for storage. Tests should set up and tear down the database per test, test CRUD operations, and ensure tests can run independently.",
"relevant_when": "Agent writes tests for a Go API with database storage",
"context": "Proactively verify that agents handle database setup/teardown correctly in Go API tests: :memory: SQLite or per-test database reset, t.Cleanup for resource cleanup, and independent tests that do not rely on execution order.",
"sources": [
{
"type": "file",
"filename": "skills/go-api-testing/SKILL.md",
"tile": "tessl-labs/go-api-testing"
}
],
"checklist": [
{
"name": "memory-sqlite-or-fresh-db",
"rule": "Tests use :memory: SQLite or create a fresh database file per test function, not a shared persistent database",
"relevant_when": "Agent sets up test database"
},
{
"name": "t-cleanup-used",
"rule": "Database connections are closed using t.Cleanup() or defer db.Close(), not left open",
"relevant_when": "Agent manages test database lifecycle"
},
{
"name": "migrations-run-in-setup",
"rule": "Test setup runs schema migrations or table creation before tests execute",
"relevant_when": "Agent sets up test database"
},
{
"name": "tests-independent",
"rule": "Each test function creates its own database state rather than depending on state from a previous test",
"relevant_when": "Agent writes multiple database tests"
},
{
"name": "crud-coverage",
"rule": "Tests cover at least create (POST) and read (GET) operations, verifying that created data can be retrieved",
"relevant_when": "Agent writes CRUD tests"
},
{
"name": "setup-helper-exists",
"rule": "There is a reusable test setup function (e.g., setupTestDB) that handles database creation and migration, called by t.Helper()",
"relevant_when": "Agent creates database test infrastructure"
}
]
}