Skip to content

Hypothesis python 高级测试库。它允许编写测试用例时参数化,然后生成使测试失败的简单易懂的测试数据。可以用更少的工作在代码中发现更多的bug。 Hypothesis is a powerful, flexible, and easy to use library for property-based testing.

License

Notifications You must be signed in to change notification settings

jdk6979/hypothesis

This branch is 5938 commits behind HypothesisWorks/hypothesis:master.

Folders and files

NameName
Last commit message
Last commit date
Dec 15, 2019
Oct 24, 2018
Feb 6, 2020
Mar 24, 2020
Oct 14, 2019
Jun 27, 2015
Mar 30, 2020
Dec 30, 2019
Feb 25, 2020
Feb 25, 2020
Feb 6, 2020
Jun 25, 2019
Feb 2, 2019
Jan 1, 2020
Feb 25, 2020
Feb 19, 2020
Mar 18, 2020
Nov 25, 2019
Nov 18, 2019
Apr 11, 2018
Jan 11, 2020
Jan 8, 2019
Apr 21, 2018
Nov 25, 2019
Mar 18, 2020
Mar 18, 2020
Jan 10, 2020
Nov 21, 2019
Nov 20, 2019
Apr 21, 2018
Jun 23, 2018

Repository files navigation

Hypothesis

Hypothesis is a family of testing libraries which let you write tests parametrized by a source of examples. A Hypothesis implementation then generates simple and comprehensible examples that make your tests fail. This simplifies writing your tests and makes them more powerful at the same time, by letting software automate the boring bits and do them to a higher standard than a human would, freeing you to focus on the higher level test logic.

This sort of testing is often called "property-based testing", and the most widely known implementation of the concept is the Haskell library QuickCheck, but Hypothesis differs significantly from QuickCheck and is designed to fit idiomatically and easily into existing styles of testing that you are used to, with absolutely no familiarity with Haskell or functional programming needed.

Hypothesis for Python is the original implementation, and the only one that is currently fully production ready and actively maintained.

Hypothesis for Other Languages

The core ideas of Hypothesis are language agnostic and in principle it is suitable for any language. We are interested in developing and supporting implementations for a wide variety of languages, but currently lack the resources to do so, so our porting efforts are mostly prototypes.

The two prototype implementations of Hypothesis for other languages are:

  • Hypothesis for Ruby is a reasonable start on a port of Hypothesis to Ruby. It worked pretty well, but uses a core Rust implementation that is unfortunately not compatible with recent versions of Rust, due to its dependency on Helix (which now seems to be mostly unmaintained) and as a result is currently unsupported pending a rewrite of the bridging code between Rust and Ruby. We don't at present have the time or funding for this project, but it is likely not a massive undertaking if anyone would like to provide either of these.
  • Hypothesis for Java is a prototype written some time ago. It's far from feature complete and is not under active development, but was intended to prove the viability of the concept.

Additionally there is a port of the core engine of Hypothesis, Conjecture, to Rust. It is not feature complete but in the long run we are hoping to move much of the existing functionality to Rust and rebuild Hypothesis for Python on top of it, greatly lowering the porting effort to other languages.

Any or all of these could be turned into full fledged implementations with relatively little effort (no more than a few months of full time work), but as well as the initial work this would require someone prepared to provide or fund ongoing maintenance efforts for them in order to be viable.

About

Hypothesis python 高级测试库。它允许编写测试用例时参数化,然后生成使测试失败的简单易懂的测试数据。可以用更少的工作在代码中发现更多的bug。 Hypothesis is a powerful, flexible, and easy to use library for property-based testing.

Resources

License

Citation

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 85.5%
  • Jupyter Notebook 8.0%
  • Rust 2.6%
  • Ruby 2.5%
  • TeX 0.6%
  • Shell 0.4%
  • Other 0.4%