36

GitHub - flyingmutant/rapid: Rapid is a Go library for property-based testing

 5 years ago
source link: https://github.com/flyingmutant/rapid
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK