testing
Skill3 starsChanged 4 months agoMITView on GitHub
Two pieces: okapi's test server / test context, and the okapitest package's fluent request builder and assertions. Constructors: *TestServer embeds *Okapi and adds BaseURL string. TestingT is satisfied by *testing.T (Helper, Cleanup, Errorf, Fatalf), so a custom harness can be plugged in. Starting an already-built app for a test: NewTestContext builds its own in-memory request and httptest.ResponseRecorder without a full Okapi engine. Verb entry points: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, plus Request(t) for a blank builder and FromRecorder(t,…
123 other projects use a version of this.
Adopted by
Most recently taken up by
- timmo001/skillstheir own version, first seen Oct 5, 2026
- kortix-ai/sunatheir own version, first seen Oct 5, 2026
- gilsmt/skillstheir own version, first seen Oct 4, 2026
- andeeplus/aplustheir own version, first seen Oct 4, 2026
- JetBrains/intellij-communitytheir own version, first seen Oct 3, 2026
- shinpr/codex-workflowstheir own version, first seen Oct 2, 2026
Used with
Projects with it also use oss-pr, pr-automation and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
CES-LtdSkilloss-pr
Use when creating a pull request, after committing changes, or when user invokes /oss-pr. Covers branch management, quality checks, commit, push, and PR creation.
Also in 3 projects that use this
CES-LtdSkillpr-automation
PR Automation Orchestrator: poll open PRs, check CI, run review, fix, and merge eligible PRs. Use when: (1) Invoked by daemon via scripts/pr-automation.sh, (2) User says "/pr-automation".
Also in 3 projects that use this
ffsshhttiikkSkillcicd
Continuous integration and delivery pipelines
Also in 4 projects that use this
ffsshhttiikkSkillnetworking
Practical application and coding skills for Networking
Also in 3 projects that use this
JohnJBorenSkillci-cd
CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies
Also in 9 projects that use this
Cogni-AI-OUSkilldotfiles
Reference for repository dotfiles, including their purposes, standard configurations, and usage guidelines. You MUST load this skill when configuring, troubleshooting, or understanding repository dotfiles.
Also in 3 projects that use this
- +2 more from CES-Ltd
- +1 more from ffsshhttiikk
Other versions123 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 123
- lobehub/lobehub★ 83ksame name
- iOfficeAI/AionUi★ 33ksame name
- JetBrains/intellij-community★ 21ksame name
- kortix-ai/suna★ 20ksame name
- modelcontextprotocol/inspector★ 11ksame name
- microsoft/fast★ 9.7ksame name
- bytebase/dbhub★ 3.6ksame name
- theopenco/llmgateway★ 1.7ksame name
- BankrBot/skills★ 1.2ksame name
- microsoft/CCF★ 875same name
113 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository20 other files it gives its agents.
- authenticationSkill
- cliSkill
- contextSkill
- dynamic_routesSkill
- error_handlingSkill
- http_clientSkill
- middlewareSkill
- openapiSkill
- overviewSkill
- request_bindingSkill
- responseSkill
- route_definitionSkill
- routingSkill
- sse_streamSkill
- std_compatSkill
- templatingSkill
- tls_httpsSkill
- validationSkill
- websocketSkill
- web_spaSkill
The file
Files
Okapi Testing
Two pieces: okapi's test server / test context, and the okapitest package's fluent request builder and assertions.
Test Server
func TestBooks(t *testing.T) {
server := okapi.NewTestServer(t) // random free port, stopped via t.Cleanup
server.Get("/books", GetBooksHandler) // *TestServer embeds *Okapi — register as usual
okapitest.GET(t, server.BaseURL+"/books").
ExpectStatusOK().
ExpectBodyContains("The Go Programming Language")
}Constructors:
okapi.NewTestServer(t TestingT) *TestServer // new Okapi instance
okapi.NewTestServerOn(t TestingT, port int) *TestServer // fixed port
okapi.NewTestServerWithOkapi(t TestingT, o *Okapi) *TestServer // wrap a configured instance
okapi.DefaultTestServer(t TestingT) *TestServer // okapi.Default() based*TestServer embeds *Okapi and adds BaseURL string.
TestingT is satisfied by *testing.T (Helper, Cleanup, Errorf, Fatalf), so a custom harness can be plugged in.
Starting an already-built app for a test:
o := buildApp() // your production wiring
baseURL := o.StartForTest(t) // starts and registers cleanup
addr := o.WaitForServer(2 * time.Second) // block until ready (when starting manually)Test Context (unit-testing a handler directly)
ctx, rec := okapi.NewTestContext("POST", "/books", strings.NewReader(`{"name":"Go"}`))
ctx.Request().Header.Set("Content-Type", "application/json")
if err := CreateBookHandler(ctx); err != nil {
t.Fatal(err)
}
okapitest.FromRecorder(t, rec).
ExpectStatusCreated().
ExpectJSONPath("name", "Go")NewTestContext builds its own in-memory request and httptest.ResponseRecorder without a full Okapi engine.
Fluent Requests (okapitest)
import "github.com/jkaninda/okapi/okapitest"
okapitest.GET(t, url).
Header("Authorization", "Bearer "+token).
ExpectStatusOK().
ExpectContentType("application/json").
ExpectBodyContains("Go Programming")
okapitest.POST(t, url).
JSONBody(map[string]any{"name": "Book"}).
ExpectStatusCreated()Verb entry points: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, plus Request(t) for a blank builder and FromRecorder(t, rec) for a recorded response.
Reusable Client
client := okapitest.NewClient(t, server.BaseURL)
client.Headers["Authorization"] = "Bearer " + token // default headers for every request
client.GET("/books").ExpectStatusOK()
client.POST("/books").JSONBody(book).ExpectStatusCreated()Request Builder
rb.Method(method) // HTTP method
rb.URL(url) // full URL
rb.Path(path) // append a path segment
rb.Header(key, value)
rb.Headers(map[string]string{...})
rb.QueryParam(key, value)
rb.QueryParams(map[string]string{...})
rb.SetBasicAuth(user, pass)
rb.SetBearerAuth(token)
rb.Body(io.Reader) // raw body
rb.JSONBody(v) // marshalled, Content-Type: application/json
rb.FormBody(map[string]string) // application/x-www-form-urlencoded
rb.Timeout(d)
rb.Execute() (*http.Response, []byte) // run and inspect manuallyAssertions are chainable and fail the test through *testing.T; the request is issued once on the first assertion.
Assertions
// Status
rb.ExpectStatus(code)
rb.ExpectStatusOK() // 200
rb.ExpectStatusCreated() // 201
rb.ExpectStatusAccepted() // 202
rb.ExpectStatusNoContent() // 204
rb.ExpectStatusBadRequest() // 400
rb.ExpectStatusUnauthorized() // 401
rb.ExpectStatusForbidden() // 403
rb.ExpectStatusNotFound() // 404
rb.ExpectStatusConflict() // 409
rb.ExpectStatusInternalServerError() // 500
// Body
rb.ExpectBody(expected) // exact match
rb.ExpectBodyContains(substr)
rb.ExpectContains(substr) // alias of ExpectBodyContains
rb.ExpectBodyNotContains(substr)
rb.ExpectEmptyBody()
// JSON
rb.ExpectJSON(expected) // deep-equal comparison
rb.ExpectJSONPath("user.profile.name", "Ada") // dot path
rb.ParseJSON(&target) // unmarshal into a struct for further checks
// Headers
rb.ExpectHeader(key, value)
rb.ExpectHeaderContains(key, substr)
rb.ExpectHeaderExists(key)
rb.ExpectContentType(contentType)
// Cookies
rb.ExpectCookieExist(name)
rb.ExpectCookie(name, value)Utilities
okapitest.GracefulExitAfter(d) // send SIGTERM after d — for shutdown/integration tests
// Deprecated one-shot helpers — prefer the builder:
okapitest.AssertHTTPStatus(t, method, url, headers, body, contentType, expected)
okapitest.AssertHTTPResponse(t, method, url, headers, body, contentType, expectedStatus, expectedBody)End-to-End Example
func TestCreateAndFetchBook(t *testing.T) {
server := okapi.NewTestServer(t)
RegisterRoutes(server.Okapi) // your wiring
client := okapitest.NewClient(t, server.BaseURL)
client.POST("/api/books").
JSONBody(okapi.M{"name": "The Go Programming Language", "price": 30}).
ExpectStatusCreated().
ExpectJSONPath("name", "The Go Programming Language")
client.GET("/api/books").
ExpectStatusOK().
ExpectContentType("application/json").
ExpectBodyContains("The Go Programming Language")
client.GET("/api/books/999").
ExpectStatusNotFound()
}Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

