property-based-testing

Guide property-based testing with Hypothesis, fast-check, and proptest.

Updated Feb 6, 2026
One-click install
npx skills add https://github.com/chadananda/xswarm-tdd-claude --skill property-based-testing-chadananda
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: property-based-testing
Source: https://github.com/chadananda/xswarm-tdd-claude/tree/main/skills/property-based-testing
Command: npx skills add https://github.com/chadananda/xswarm-tdd-claude --skill property-based-testing-chadananda

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps development teams adopt property-based testing to improve test coverage and reduce brittle example-based tests by focusing on how code behaves across a wide range of inputs.

Core Features & Use Cases

  • Establishes a pattern catalog (Roundtrip, Idempotence, Invariant, Commutativity, Oracle) to drive robust tests.
  • Guides design of input strategies that encode constraints, reducing reliance on post-hoc filtering.
  • Provides cross-language guidance and examples for serialization, parsing, validation, and smart-contract scenarios.

Quick Start

Start by installing a property-based testing library for your language of choice (e.g., Hypothesis for Python, fast-check for JavaScript). Identify a target function, design input strategies that reflect real constraints, then write 2–3 properties that express core guarantees. Run tests to observe failures and iterate.

Frequently Asked Questions about property-based-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does property-based testing improve test coverage for serialization and parsing?

Property-based testing improves serialization and parsing coverage by validating universal invariants like roundtrip and idempotence across a wide range of generated inputs, rather than relying on brittle example-based tests.

How do I design input strategies that reflect real constraints in fast-check or Hypothesis?

To design input strategies in fast-check or Hypothesis, encode domain constraints directly into the generators to produce valid inputs, reducing reliance on post-hoc filtering and ensuring tests target meaningful edge cases.

What are common property-based testing patterns for validation and normalization?

Common property-based testing patterns for validation and normalization include roundtrip testing, idempotence, invariant preservation, commutativity, and oracle testing to verify core functional guarantees across diverse inputs.

Can I use property-based testing for smart contracts across different languages?

You can apply property-based testing to smart contracts across different languages by using libraries like Hypothesis, fast-check, and proptest to scaffold tests that verify invariants and commutativity.

Why should I choose property-based testing over example-based tests?

Choose property-based testing over example-based tests to reduce brittleness and automatically explore a wide input space, discovering edge cases in parsing and validation logic that manual examples often miss.