CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/go-api-testing

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

1.06x
Quality

98%

Does it follow best practices?

Impact

99%

1.06x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

criteria.jsonevals/scenario-1/

{
  "context": "Tests whether the agent creates properly isolated database tests for a Go API: each test gets its own :memory: SQLite database, migrations run in setup, t.Cleanup closes connections, and tests do not depend on execution order.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Memory SQLite per test",
      "description": "Each test (or test setup function) opens a new :memory: SQLite database rather than sharing a file-based database across tests",
      "max_score": 15
    },
    {
      "name": "Migrations in setup",
      "description": "The test setup function runs schema migrations (CREATE TABLE) before the test begins",
      "max_score": 10
    },
    {
      "name": "setupTestDB helper with t.Helper",
      "description": "There is a reusable setupTestDB (or similar) function that calls t.Helper() and returns a configured *sql.DB",
      "max_score": 10
    },
    {
      "name": "t.Cleanup for DB close",
      "description": "The database connection is closed via t.Cleanup(func() { db.Close() }) or defer db.Close() within the setup helper",
      "max_score": 10
    },
    {
      "name": "Tests are independent",
      "description": "Each test function calls the setup helper independently -- no shared package-level database variable used across tests",
      "max_score": 10
    },
    {
      "name": "Create task test",
      "description": "There is a test that creates a task via POST and verifies the 201 response",
      "max_score": 8
    },
    {
      "name": "Create then fetch test",
      "description": "There is a test that creates a task via POST then fetches it via GET to verify persistence",
      "max_score": 10
    },
    {
      "name": "Status update test",
      "description": "There is a test for the PATCH /api/tasks/{id}/status endpoint testing valid and invalid status transitions",
      "max_score": 8
    },
    {
      "name": "Error paths tested",
      "description": "Tests include 404 (nonexistent task) and 400 (missing title, invalid status) error cases",
      "max_score": 10
    },
    {
      "name": "Table-driven with t.Run",
      "description": "At least one test uses table-driven pattern with t.Run subtests",
      "max_score": 9
    }
  ]
}

evals

scenario-1

criteria.json

task.md

tile.json