property-based-testing

Guide property-based testing with input strategies and invariants across languages.

2|Updated Jan 21, 2026
One-click install
npx skills add https://github.com/roderik/mpe --skill property-based-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: property-based-testing
Source: https://github.com/roderik/mpe/tree/main/.agents/skills/property-based-testing
Command: npx skills add https://github.com/roderik/mpe --skill property-based-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Property-based testing provides a rigorous approach to validate software by asserting properties across wide input spaces instead of relying solely on example-based tests. It helps uncover edge cases and invariants early, across languages and domains including smart contracts.

Core Features & Use Cases

  • Guidance on designing input strategies (roundtrip, idempotence, invariants)
  • Patterns across languages (Python/Hypothesis, JS/fast-check, Rust/proptest, Solidity/Echidna)
  • Practical workflows for unit and contract testing

Quick Start

Ask me to apply property-based testing to a function or contract to design a test suite that checks roundtrip and invariants, with example strategies and properties.

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 find edge cases better than example-based tests?

Property-based testing uncovers edge cases by asserting logical invariants across wide input spaces rather than checking isolated examples. It generates hundreds of test inputs automatically, exposing hidden failures and validating properties like roundtrip and idempotence early.

How do I design input strategies for property-based testing in Python or JavaScript?

Design input strategies for property-based testing by defining generators that produce realistic data ranges for tools like Hypothesis or fast-check. You define constraints to shrink input spaces, ensuring tests validate properties like invariants and roundtrips without hitting tautologies.

Can I use property-based testing for smart contract testing in Solidity?

Yes, property-based testing applies to smart contract testing by validating invariants and state transitions across arbitrary transaction sequences. It integrates with contract tools like Echidna to fuzz inputs and verify that protocol guarantees hold under unexpected edge cases.

What is the difference between testing invariants and testing roundtrips?

Testing invariants checks that a state remains unchanged after operations, while testing roundtrips verifies that a function and its inverse return the original input. Both are properties evaluated across generated data sets rather than single hardcoded examples.

When should I avoid using property-based testing for my unit tests?

Avoid property-based testing when tests require highly specific UI interactions or when setting up complex state yields diminishing returns. If strategies become tautologies or input generation fails to cover valid edge cases, example-based tests offer simpler, more direct validation.

Does property-based testing work with Rust proptest and JavaScript fast-check?

Yes, property-based testing works across languages using tools like Rust proptest and JavaScript fast-check. These frameworks generate diverse input strategies, allowing you to validate properties like idempotence and roundtrips consistently across different tech stacks.