|
| 1 | +# Fuzz Testing with Rendezvous |
| 2 | + |
| 3 | +Smart contracts on Stacks are immutable. Bugs are forever. Test early. Test |
| 4 | +often. Fuzzing finds edge cases that unit tests often miss. |
| 5 | + |
| 6 | +## What is Fuzz Testing? |
| 7 | + |
| 8 | +Fuzzing hits your code with random inputs. It helps uncover unexpected |
| 9 | +behavior and subtle bugs. Unlike unit tests, it explores paths you didn't |
| 10 | +think of. |
| 11 | + |
| 12 | +Rendezvous (`rv`) is a Clarity fuzzer. It supports: |
| 13 | + |
| 14 | +### Property-Based Testing |
| 15 | + |
| 16 | +You define a property. Rendezvous checks it with random inputs. |
| 17 | + |
| 18 | +- **Properties**: Truths that must always hold. |
| 19 | +- **Generators**: Create random input data. |
| 20 | +- **Shrinking**: Reduce failing input to the minimal case. |
| 21 | + |
| 22 | +### Invariant Testing |
| 23 | + |
| 24 | +You define conditions that must always hold. Rendezvous runs sequences of |
| 25 | +calls to verify them. |
| 26 | + |
| 27 | +- **Invariants**: Must always be true. |
| 28 | +- **State transitions**: What changes with each call. |
| 29 | +- **Function sequences**: Random sequences of calls to test state consistency. |
| 30 | + |
| 31 | +## Why Test in Clarity? |
| 32 | + |
| 33 | +Rendezvous tests run in Clarity, just like your contracts. |
| 34 | + |
| 35 | +1. Tests operate under the exact same constraints as production code. |
| 36 | +2. Better understanding of Clarity. |
| 37 | +3. No need to expose internals as public functions. |
| 38 | +4. Fewer tools to manage. |
| 39 | + |
| 40 | +## Getting Started |
| 41 | + |
| 42 | +Put tests next to contracts. Rendezvous will find them. |
| 43 | + |
| 44 | +``` |
| 45 | +my-project/ |
| 46 | +├── Clarinet.toml |
| 47 | +├── contracts/ |
| 48 | +│ ├── my-contract.clar # Contract |
| 49 | +│ ├── my-contract.tests.clar # Tests |
| 50 | +└── settings/ |
| 51 | + └── Devnet.toml |
| 52 | +``` |
| 53 | + |
| 54 | +See full docs at: |
| 55 | +https://stacks-network.github.io/rendezvous/ |
0 commit comments