Property-Based Test Generator

advancedtestingMin 32K context

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.

Use Cases

  • 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

Example Prompt

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

Recommended Models

Compatible Tools

claude-codecursorkiroany

Modalities

Input: text, code
Output: text, code

Related Skills

Author

OpenModels Community

@openmodelsrun