Go Testing Advanced

Guides Go's advanced testing techniques — native fuzzing (FuzzXxx, f.Add seed corpus, f.Fuzz property body, the testdata/fuzz corpus, go test -fuzz); benchmarks with the Go 1.24 `for b.Loop()` loop that replaces the error-prone `for i := 0; i less than b.N; i++`, plus b.ReportAllocs, b.ResetTimer, b.RunParallel, and keeping the result alive so the optimizer can't delete the body; testing/synctest (Go 1.25) for deterministic, instant time-based concurrency tests instead of flaky time.Sleep; go test -cover as a guide not a target; and the stdlib-over-testify stance. Auto-invokes when writing or editing benchmarks, fuzz tests, FuzzXxx, b.Loop/b.N, testing/synctest, coverage, or deciding stdlib testing vs testify, or on "benchmark this" / "fuzz this" / "why is this concurrency test flaky" requests. Routes table tests, subtests, helpers, and golden files to go-testing-tabledriven.

ctoth be94888 3 files · 34.2 KB Updated

File contents

ctoth/golang-skills-plugin/tree/main/plugins/golang/skills/go-testing-advanced commit be948881b9

Frequently asked questions

npx skillmds@latest add ctoth/go-testing-advanced