- Home
- Skills
- Dexploarer
- Claudius Skills
- Property Based Test Generator
property-based-test-generator_skill
- TypeScript
4
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill dexploarer/claudius-skills --skill property-based-test-generator- SKILL.md14.9 KB
Overview
This skill generates property-based tests for Python (Hypothesis), JavaScript/TypeScript (fast-check), and Haskell (QuickCheck). It produces runnable test examples, custom arbitraries/strategies, stateful and model-based tests, and CI integration suggestions to catch edge cases automatically. Use it to validate invariants rather than specific outputs and to accelerate discovery of surprising inputs.
How this skill works
The skill inspects the target function and project language, then suggests appropriate property patterns (idempotence, roundtrip, commutativity, invariants, etc.). It generates concrete test code using Hypothesis, fast-check, or QuickCheck, including custom generators, preconditions, shrinking-friendly properties, and configuration for CI. It also offers guidance on fixtures, stateful testing, and reproducing failures via seeds or examples.
When to use it
- You want to automatically find edge cases beyond unit tests
- You need hypothesis tests for a Python function
- You want fast-check tests for JavaScript or TypeScript code
- You need invariants (roundtrip, idempotence, commutativity) validated
- You plan to add property testing to CI to prevent regressions
Best practices
- Test invariants and high-level properties, not implementation details
- Start with simple properties and add complexity after passing basics
- Use preconditions (assume/fc.pre) to restrict valid inputs
- Leverage shrinking by keeping properties minimal and expressive
- Combine property tests with unit tests; don’t replace all unit tests
Example use cases
- Generate Hypothesis tests to verify json encode/decode roundtrips for Python serializers
- Create fast-check properties for string utilities like reverse or trim in a TypeScript codebase
- Model-based tests for a stack or shopping cart to validate stateful behavior
- Compare optimized and naive implementations using differential testing
- Add property tests to CI with reproducible seeds and reporting settings
FAQ
Use the library’s seed/path or add explicit examples. fast-check accepts seed and path; Hypothesis supports @example and settings with a fixed seed or verbose output for reproduction.
When should I use stateful or model-based testing?
Use stateful or model-based testing when behavior depends on sequences of operations or internal state (e.g., stacks, carts, protocols). Start with simple rules and invariants, then grow the model as needed.