简体   繁体   English

我们可以在 Hypothesis Python 框架中控制测试用例分布吗?

[英]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.

相关问题 如何在Python鼻子测试中控制函数执行的顺序 - How can we control the sequence of function execution in Python Nose test 如何在同一测试用例中使用假设和基于pytest-tornado yield的测试? - How can I use hypothesis, and pytest-tornado yield-based testing, in the same test case? 使用faker的python假设单元测试 - python hypothesis unit test using faker 使用假设测试 Python function 引发错误 - Test Python function raising an Error using Hypothesis Python unittest:我们可以重复单元测试用例执行可配置的次数吗? - Python unittest: Can we repeat Unit test case execution for a configurable number of times? 在这种情况下我们可以形成一个Python列表理解吗? - Can we form a Python List Comprehension in this case? python中分布的正态性检验 - normality test of a distribution in python 如何以编程方式将假设结合到我的代码中而不是作为测试? (使用Hypothesis区分自动机和Python函数) - How to combine Hypothesis in my code programaticly and not as a test? (Use Hypothesis to distinguish between automata and Python function) 根据 null 假设测试 80,000 多个模拟正态分布观察集 - Test 80,000+ simulated normal distribution observation sets against a null hypothesis Python和Statsmodels:如何包含替代test_t假设? - Python and Statsmodels: How to include the alternative test_t hypothesis?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM