CheckOps
Rapid
Rapid is an MPL-2.0 property-based testing library for Go, inspired by Hypothesis, with automatic shrinking, state machine testing and integration with go test.
Latest public signals
Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.
Introduction
Rapid is a Go library for property-based testing. Instead of writing individual examples, you describe how to generate inputs and state a property that should always hold, and Rapid checks it against many generated cases. Its design is inspired by Python’s Hypothesis, and it works directly with the standard testing package.
Inside rapid.Check(t, func(t *rapid.T) { ... }) you draw values from generators such as rapid.Int(), rapid.String(), rapid.SliceOf(...) and rapid.Custom(...). When a property fails, Rapid automatically shrinks the input to a minimal failing case without user-written shrinkers, and failing cases can be replayed. State machine testing via t.Repeat generates sequences of actions to test stateful code against a model, and Rapid can also be used to drive Go’s native fuzzing. Version 1.3.0 was released on 30 April 2026.
The source code is at flyingmutant/rapid on GitHub under the MPL-2.0 licence, with about 915 stars; the most recent commit was on 4 September 2026.
Features
- Hypothesis-style generators: Composable generators with automatic shrinking.
- go test integration: Properties are ordinary Go tests.
- State machine testing: Generate action sequences for stateful code.
- Reproducible failures: Replay minimised failing cases.
Pros
- Free to use: Open source under the MPL-2.0 licence, so the core tool costs nothing to use.
- Actively maintained: The repository had commits as recent as 4 September 2026.
Cons
- Smaller community: Fewer examples than testify or gomock.
- Properties need thought: Good invariants take practice to write.
Usage and Links (Example)
import (
"sort"
"testing"
"pgregory.net/rapid"
)
func TestSortIsIdempotent(t *testing.T) {
rapid.Check(t, func(t *rapid.T) {
xs := rapid.SliceOf(rapid.Int()).Draw(t, "xs")
once := append([]int(nil), xs...)
sort.Ints(once)
twice := append([]int(nil), once...)
sort.Ints(twice)
if !equal(once, twice) {
t.Fatalf("sort not idempotent: %v vs %v", once, twice)
}
})
}
Resources:
Pricing
Rapid is free and open source under the MPL-2.0 licence.
Recommended for?
- Go developers wanting property-based testing with automatic shrinking.
- Stateful components tested against a model.
Conclusion
Rapid brings modern, Hypothesis-style property-based testing to Go with minimal ceremony.
Alternatives
Other tools on CheckOps that cover similar ground. Open a page, or compare one with Rapid side by side.
GGo testing packageGo's built-in testing package and go test command provide unit tests, table-driven subtests, benchmarks, fuzzing, examples and coverage with no third-party dependencies.Compare with Rapid
HHypothesisHypothesis is the MPL-2.0 property-based testing library for Python: describe the range of inputs, let it generate cases including edge cases, and get the simplest failing example when a property breaks.Compare with Rapid
Pproptestproptest is a Hypothesis-inspired property-based testing framework for Rust, with composable strategies, automatic shrinking and persisted regression files.Compare with Rapid
Ffast-checkfast-check is an MIT-licensed property-based testing framework for JavaScript and TypeScript, with rich arbitraries, shrinking, replayable seeds, model-based testing and race-condition detection.Compare with Rapid
TTestifyTestify is an MIT-licensed Go toolkit with assert and require assertion packages, mock objects and test suites, the most widely used testing library in the Go ecosystem.Compare with Rapid
GGoMock (uber-go/mock)GoMock is an Apache-2.0 mocking framework for Go, maintained by Uber after the original golang/mock was archived, with the mockgen code generator and a gomock controller for expectations.Compare with Rapid