property-based-testing

Featured

Property-based testing with fast-check (TypeScript/JavaScript) and Hypothesis (Python). Generate test cases automatically, find edge cases, and test mathematical properties. Use when user mentions property-based testing, fast-check, Hypothesis, generating test data, QuickCheck-style testing, or finding edge cases automatically.

AI & Automation 3,831 stars 344 forks Updated 1 weeks ago Apache-2.0

Install

View on GitHub

Quality Score: 97/100

Stars 20%
100
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Property-Based Testing Expert knowledge for property-based testing - automatically generating test cases to verify code properties rather than testing specific examples. ## Core Expertise **Property-Based Testing Concept** - **Traditional testing**: Test specific examples - **Property-based testing**: Test properties that should hold for all inputs - **Generators**: Automatically create diverse test inputs - **Shrinking**: Minimize failing cases to simplest example - **Coverage**: Explore edge cases humans might miss **When to Use Property-Based Testing** - Mathematical operations (commutative, associative properties) - Encoders/decoders (roundtrip properties) - Parsers and serializers - Data transformations - API contracts - Invariants and constraints ## TypeScript/JavaScript (fast-check) ### Installation ```bash # Using Bun bun add -d fast-check # Using npm npm install -D fast-check ``` ### Basic Example ```typescript import { test } from 'vitest' import * as fc from 'fast-check' // Traditional example-based test test('reverse twice returns original', () => { expect(reverse(reverse([1, 2, 3]))).toEqual([1, 2, 3]) }) // Property-based test test('reverse twice returns original - property based', () => { fc.assert( fc.property( fc.array(fc.integer()), // Generate random arrays of integers (arr) => { expect(reverse(reverse(arr))).toEqual(arr) } ) ) }) // fast-check automatically generates 100s of test cases! ``` ### Built-i...

Details

Author
foryourhealth111-pixel
Repository
foryourhealth111-pixel/Vibe-Skills
Created
8 months ago
Last Updated
1 weeks ago
Language
Python
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

Testing & QA Solid

property-based-testing

Property-based testing (PBT) patterns with fast-check (JS/TS), Hypothesis (Python), and gopter (Go). Generate random inputs, define invariants, shrink failures to minimal cases. Adapted from Trail of Bits. Use when testing pure functions, parsers, serializers, state machines, or any code where example-based tests miss edge cases.

552 Updated 6 days ago
vibeeval
Testing & QA Listed

property-testing

Property-based testing with fast-check for business logic validation

6 Updated 9 months ago
captjay98
Testing & QA Listed

property-testing

Property-based tests: fast-check with Vitest in TypeScript, Hypothesis with pytest in Python. Writes new property tests, exposes a property in code that seems to have none, reviews existing property tests for ones that assert nothing, and triages a failed property test into a wrong property, an ambiguous spec or a real bug. Use it when the owner asks for property tests or for inputs the existing tests miss: "write property tests for this parser", "find the edge cases this function misses", "test the invariants", "tests are green but prod breaks on odd input", "model-based test for this state machine or cache", "do these property tests check anything real", "my property test failed, is it a bug or a wrong property". Also use it on your own in test-first work when the function has an inverse, normalizes or sorts, does arithmetic over money or limits, parses data through a schema, or holds state. Not for binary fuzzing (libFuzzer, AFL), mutation testing, benchmarks or end-to-end UI tests.

4 Updated 1 weeks ago
nyxandro