Property-Based Test Generator

高级testing最低上下文:32K

Generates property-based tests that assert invariants across randomly generated inputs using frameworks like Hypothesis, fast-check, or jqwik. Identifies properties (round-trip, idempotence, invariants, oracle comparison), defines generators and shrinking, and sets up stateful testing for complex APIs. Surfaces edge cases that example-based tests miss.

使用场景

  • Adding property-based tests for a parser or serializer
  • Testing round-trip and idempotence properties
  • Defining custom generators and shrinking
  • Stateful testing of a data structure or API
  • Finding edge cases example tests miss

示例提示词

Generate property-based tests for this function: [paste function].
Include:
1. Identified properties (round-trip, invariants, oracle)
2. Input generators and shrinking strategy
3. Tests using [Hypothesis/fast-check/jqwik]
4. A stateful test if applicable
5. Notes on edge cases the properties should reveal

推荐模型

兼容工具

claude-codecursorkiroany

模态

输入: text, code
输出: text, code

相关 Skills

作者

OpenModels Community

@openmodelsrun