简体   繁体   中英

Can we control test case distribution in Hypothesis Python framework?

Property based framework QuickCheck can be instructed to measure how often a particular test case is generated by using collect and measure utility functions (for example: how often the same person on average places an order, how often empty orders are placed). Is there a possibility to adjust the distribution of test cases generated by a rule based statemachine in Hypothesis framework as in Quickcheck?

You can see the frequency of custom events using the event() function and the --hypothesis-show-statistics argument to pytest.

Our stateful testing doesn't support user-defined distributions, which we have found are usually counter-productive, but we do automatically use Swarm Testing to give you an empirically better-than-naive-random distribution - see https://hypothesis.readthedocs.io/en/latest/changes.html#v4-49-0 - among other tricks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM