nw-property-based-testing

Solid

Property-based testing strategies, mutation testing, shrinking, and combined PBT+mutation workflow for test quality validation

Testing & QA 526 stars 55 forks Updated 1 weeks ago MIT

Install

View on GitHub

Quality Score: 92/100

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

Skill Content

# Property-Based Testing and Mutation Testing > Deferred to Phase 2.25: Mutation testing runs ONCE per feature as final quality gate at orchestrator Phase 2.25 (after all steps complete). Do NOT run mutation testing during inner TDD loop. ## Property-Based Testing (PBT) Instead of examples ("given X, expect Y"), write properties ("for all valid inputs, condition Z holds"). Framework generates hundreds/thousands of inputs checking property. Dramatically expands test coverage. ## Property Patterns 1. **Invariants**: "for all inputs, condition holds" (sorted list is ordered, balance >= 0) 2. **Roundtrip**: "encode then decode = original" (serialize/deserialize, compress/decompress) 3. **Oracle**: "compare against reference implementation" (optimized vs correct-but-slow) 4. **Metamorphic**: "different operations, same result" (add(a,b)==add(b,a), filter can't increase size) ## Shrinking When property fails, framework auto-finds minimal failing input. Dramatically accelerates debugging. Algorithm: find failing input -> try simpler variants -> if still fails, use as new candidate -> repeat. ## PBT Tools by Language | Language | Framework | |----------|-----------| | Python | Hypothesis | | JavaScript/TypeScript | fast-check | | Haskell | QuickCheck | | Rust | quickcheck | | Java | jqwik | | C# | FsCheck | Adopted by Amazon, Volvo, Stripe, Jane Street (ICSE 2024 study). ## When PBT Adds Value HIGH value: algorithms | data structures | serialization | business rules (valida...

Details

Author
nWave-ai
Repository
nWave-ai/nWave
Created
3 months ago
Last Updated
1 weeks ago
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category