TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Finding Property Tests (2019)

43 点作者 gmcabrita超过 5 年前

3 条评论

Noumenon72超过 5 年前
&gt; A different testing style is property based testing (PBT) with contracts. By generating a random set of inputs, we cover more of the state space than we’d do manually.<p>For someone new to the way you define property and contracts, the second sentence is not enough definition. The article made sense once I found other links in the article defining property and contracts: <a href="https:&#x2F;&#x2F;fsharpforfunandprofit.com&#x2F;posts&#x2F;property-based-testing-2&#x2F;" rel="nofollow">https:&#x2F;&#x2F;fsharpforfunandprofit.com&#x2F;posts&#x2F;property-based-testi...</a> and <a href="https:&#x2F;&#x2F;www.hillelwayne.com&#x2F;post&#x2F;contracts&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.hillelwayne.com&#x2F;post&#x2F;contracts&#x2F;</a>.<p>I would summarize by saying<p>&gt; A different testing style is property based testing (PBT) with contracts. By testing invariant properties like commutativity instead of specific cases, and writing the functions under test with assertion-like contracts that fail if they ever attempt invalid behavior, we can test with random input data and cover more of the search space than we would manually.
评论 #22105208 未加载
unhammer超过 5 年前
Interesting, it&#x27;s always useful to see strategies of coming up with property tests.<p>However, it kind of takes away the punch when both of the issues (&quot;None&quot; as an element in a list of numbers and 0 being falsy) would have have been eliminated by the type checker in a language like Haskell.
kqr超过 5 年前
The concept of metamorphic testing sounds incredibly fruitful. I haven&#x27;t immediately figured out how I can apply it to my domain, but I suspect it can elevate the testing we currently do to much more useful&#x2F;meaningful levels.