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

test-go-table-driven-validation.jsonverifiers/

{
  "instruction": "Write table-driven tests for input validation in a Go API. Test multiple invalid inputs (empty body, missing required fields, invalid formats) using a test table with t.Run subtests.",
  "relevant_when": "Agent writes validation tests for a Go API",
  "context": "Proactively verify that agents use Go's table-driven test idiom for validation testing: struct slice with named test cases, t.Run for subtests, and comprehensive coverage of invalid inputs.",
  "sources": [
    {
      "type": "file",
      "filename": "skills/go-api-testing/SKILL.md",
      "tile": "tessl-labs/go-api-testing"
    }
  ],
  "checklist": [
    {
      "name": "test-table-struct",
      "rule": "Tests define a slice of anonymous structs with at least name, input/body, and expected status code fields",
      "relevant_when": "Agent writes table-driven tests"
    },
    {
      "name": "t-run-subtests",
      "rule": "Each test case is executed inside t.Run(tt.name, func(t *testing.T) { ... }) for named subtests",
      "relevant_when": "Agent iterates over test table"
    },
    {
      "name": "multiple-invalid-inputs",
      "rule": "The test table includes at least 3 different invalid input variations (e.g., empty body, missing field, invalid format)",
      "relevant_when": "Agent tests input validation"
    },
    {
      "name": "happy-path-included",
      "rule": "The test table includes at least one valid input case alongside the invalid cases",
      "relevant_when": "Agent writes validation tests"
    },
    {
      "name": "error-body-checked",
      "rule": "Tests assert the error response body content (error message or field), not just the HTTP status code",
      "relevant_when": "Agent asserts validation errors"
    },
    {
      "name": "httptest-used",
      "rule": "Tests use httptest.NewRequest and httptest.NewRecorder, not real HTTP calls or external test frameworks",
      "relevant_when": "Agent writes Go API validation tests"
    }
  ]
}

tile.json