nw-pbt-stateful

Solid

Stateful property-based testing patterns, model-based testing, and anti-patterns

AI & Automation 526 stars 55 forks Updated 1 weeks ago MIT

Install

View on GitHub

Quality Score: 95/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

# Stateful PBT Stateful property-based testing for systems with mutable state. Language-agnostic concepts; load language skills for framework syntax. ## When to Use Stateful vs Stateless PBT ``` Is the system under test a pure function? Yes -> Use stateless PBT (pbt-fundamentals skill) No -> Does it have mutable state that affects behavior? Yes -> Does the state change through a sequence of operations? Yes -> Use stateful PBT (this skill) No -> Use stateless PBT with setup/teardown No -> Use stateless PBT ``` Use stateful PBT for: databases | APIs | caches | queues | state machines | protocols | connection pools | file systems. ## Core Concepts ### The Model Simplified representation of system's expected state. Drives test generation and verification. Rules for model design: - Simpler than system under test (key-value store model is just a dict) - Captures observable behavior, not implementation details - Pure -- no side effects in model code - Source of authority during both generation and shrinking ### Commands Each command defines four things: | Component | Purpose | When It Runs | |-----------|---------|-------------| | Precondition | Is this command valid in current state? | Generation + shrinking | | Execution | Run operation on real system | Execution phase only | | State transition | Update model | Both phases | | Postcondition | Does real result match model? | Execution phase only | ### Two-Phase Execution **Phase 1 -- Generatio...

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