Rapid is a Go library for property-based testing
Branch: master
Clone or download
Latest commit 44272da Feb 15, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig Initial commit Feb 4, 2019
.gitattributes ci: use .gitattributes to work around Travis settings core.autocrlf=t… Feb 5, 2019
.gitignore Initial commit Feb 4, 2019
.travis.yml ci: do not build wip- branches Feb 12, 2019
CONTRIBUTING.md Add CONTRIBUTING.md Feb 8, 2019
LICENSE Initial commit Feb 4, 2019
README.md README: better wording Feb 7, 2019
TODO.md TODO update Feb 15, 2019
collections.go More precise repeat labels Feb 14, 2019
collections_external_test.go Initial commit Feb 4, 2019
collections_test.go Initial commit Feb 4, 2019
combinators.go Faster (*tupleGen).String() Feb 15, 2019
combinators_external_test.go Initial commit Feb 4, 2019
combinators_test.go Introduce -rapid.seed flag Feb 8, 2019
data.go Rename removable groups to standalone Feb 12, 2019
data_test.go Introduce -rapid.seed flag Feb 8, 2019
doc.go doc: first bits of broken english Feb 6, 2019
engine.go Eager and more efficient traceback construction Feb 15, 2019
engine_test.go Eager and more efficient traceback construction Feb 15, 2019
example_function_test.go examples: work around godoc.org oddities Feb 6, 2019
example_statemachine_test.go Avoid empty queues in statemachine tests Feb 11, 2019
failure_external_test.go Initial commit Feb 4, 2019
generator.go Mark generated value groups as removable Feb 12, 2019
generator_test.go Introduce -rapid.seed flag Feb 8, 2019
go.mod Initial commit Feb 4, 2019
integers.go Less %v in fmt.Sprintf Feb 15, 2019
integers_external_test.go Rename -ext.flaky internal test flag to -flaky.ext Feb 15, 2019
regexp_external_test.go Initial commit Feb 4, 2019
shrink.go Add -rapid.shrinktime flag Feb 14, 2019
shrink_test.go Eager and more efficient traceback construction Feb 15, 2019
statemachine.go Avoid t.Helper() where possible Feb 15, 2019
statemachine_test.go Add gopter circular queue bug to buggyQueue (disabled by default) Feb 15, 2019
strings.go Less %v in fmt.Sprintf Feb 15, 2019
strings_external_test.go Initial commit Feb 4, 2019
tuple.go Optimize assertCallable() a bit Feb 15, 2019
utils.go More precise repeat labels Feb 14, 2019
utils_test.go More precise repeat labels Feb 14, 2019
vis.go vis: make linter happier Feb 6, 2019
vis_test.go Introduce -rapid.seed flag Feb 8, 2019

README.md

Rapid Build Status GoDoc

Rapid is a Go library for property-based testing.

Rapid checks that properties you define hold for a large number of automatically generated test cases. If a failure is found, rapid automatically minimizes the failing test case before presenting it.

Property-based testing emphasizes thinking about high level properties the program should satisfy rather than coming up with a list of individual examples of desired behavior (test cases). This results in concise and powerful tests that are a pleasure to write.

Design and implementation of rapid are heavily inspired by Hypothesis, which is itself a descendant of QuickCheck.

Features

  • Idiomatic Go API
  • Automatic minimization of failing test cases
  • No dependencies outside of the Go standard library

Planned features

  • Automatic persistence of failing test cases

Examples

Example function and state machine tests are provided. They both fail. Making them pass is a good way to get first real experience of working with rapid.

Comparison

Rapid aims to bring to Go the power and convenience Hypothesis brings to Python.

Compared to gopter, rapid:

  • has a much simpler API (queue test in rapid vs gopter)
  • does not require any user code to minimize failing test cases
  • uses more sophisticated algorithms for data generation

Compared to testing/quick, rapid:

  • provides much more control over test case generation
  • supports state machine ("stateful" or "model-based") testing
  • automatically minimizes any failing test case
  • has to settle for rapid.Check being the main exported function instead of much more stylish quick.Check

Status

Rapid is alpha software. Important pieces of functionality are missing; API breakage and bugs should be expected.

If rapid fails to find a bug you believe it should, or the failing test case that rapid reports does not look like a minimal one, please open an issue.

License

Rapid is licensed under the Mozilla Public License version 2.0.