nw-pbt-fundamentals

Clarify property-based testing concepts with taxonomy, generator patterns, and shrinking strategies.

Updated Mar 18, 2024
One-click install
npx skills add https://github.com/v1bh0r/precise-ledger-pro --skill nw-pbt-fundamentals-v1bh0r
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nw-pbt-fundamentals
Source: https://github.com/v1bh0r/precise-ledger-pro/tree/main/nWave/skills/nw-pbt-fundamentals
Command: npx skills add https://github.com/v1bh0r/precise-ledger-pro --skill nw-pbt-fundamentals-v1bh0r

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Property-based testing helps teams reason about software correctness across large input spaces, reducing flaky tests and manual test case creation.

Core Features & Use Cases

  • Property taxonomy: Invariant, Idempotency, Round-trip, Oracle, Metamorphic, Commutativity, Inductive, Hard-to-find/easy-to-verify.
  • Generator Design Patterns: Built-in primitives, Map, Filter, FlatMap/Chain, Recursive generators, Weighted distributions.
  • Scenarios: Cross-language applicability; framework-agnostic guidance; when to use PBT vs example-based tests.

Quick Start

Write a minimal property-based test for a simple function in your language and run it to observe a failing case.

Frequently Asked Questions about nw-pbt-fundamentals

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is property-based testing and when should I use it?

Property-based testing reasons about software correctness across large input spaces, reducing flaky tests. Use it over example-based tests when you need to verify system invariants and behaviors across a wide range of automatically generated inputs.

How do I design generators for property-based testing?

Design generators using built-in primitives, Map, Filter, FlatMap, and recursive patterns. These generator patterns allow you to control input distributions, generate complex data structures, and target specific edge cases for your property-based tests.

What are the different types of properties I can test?

Properties are categorized into a taxonomy including invariants, idempotency, round-trip, oracle, metamorphic, and commutativity. Selecting the right property type helps you define robust assertions that verify complex software behaviors accurately.

Does property-based testing work with my existing testing framework?

Yes, property-based testing is cross-language and framework-agnostic. It requires no external tools beyond standard PBT libraries, providing pragmatic guidance and examples that integrate smoothly into your existing software engineering workflow.

What is shrinking in property-based testing and how does it help?

Shrinking is a strategy in property-based testing that minimizes failing test cases to their simplest form. It helps developers quickly identify the exact input conditions that trigger a failure, making debugging significantly more efficient.

What are common misuses of property-based testing to avoid?

Common misuses include writing overly complex properties or ignoring shrinking strategies. Understanding property taxonomy and generator design patterns helps avoid these pitfalls, ensuring your property-based tests remain robust, maintainable, and effective.