[英]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).可以指示基于属性的框架 QuickCheck 使用收集和测量实用函数来测量特定测试用例生成的频率(例如:同一个人平均下订单的频率,下空订单的频率)。 Is there a possibility to adjust the distribution of test cases generated by a rule based statemachine in Hypothesis framework as in Quickcheck?是否有可能像 Quickcheck 一样,在 Hypothesis 框架中调整由基于规则的状态机生成的测试用例的分布?
You can see the frequency of custom events using the event() function and the --hypothesis-show-statistics argument to pytest.您可以使用 event() 函数和 pytest 的 --hypothesis-show-statistics 参数查看自定义事件的频率。
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.我们的有状态测试不支持用户定义的分布,我们发现这通常会适得其反,但我们会自动使用 Swarm 测试为您提供经验上优于天真的随机分布 - 请参阅https://hypothesis。 readthedocs.io/en/latest/changes.html#v4-49-0 - 还有其他技巧。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.