Skip to content

Commit 0cbffda

Browse files
committed
Add fuzz testing intro with link to Rendezvous docs
This includes: - Section README introduction - Fuzz testing guide with key concepts and tool overview - Link to Rendezvous documentation - SUMMARY.md updates for navigation
1 parent 45f684e commit 0cbffda

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

SUMMARY.md

+2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
* [Post Conditions with Stacks.js](guides-and-tutorials/frontend/post-conditions-with-stacks.js.md)
7575
* [Authentication with Stacks.js](guides-and-tutorials/frontend/authentication-with-stacks.js.md)
7676
* [Sending Transactions with Stacks.js](guides-and-tutorials/frontend/sending-transactions-with-stacks.js.md)
77+
* [Testing Smart Contracts](guides-and-tutorials/testing-smart-contracts/README.md)
78+
* [Fuzz Testing](guides-and-tutorials/testing-smart-contracts/fuzz-testing.md)
7779
* [Run a Node](guides-and-tutorials/nodes-and-miners/README.md)
7880
* [Run a Node with Docker](guides-and-tutorials/nodes-and-miners/run-a-node-with-docker.md)
7981
* [Run a Node with Digital Ocean](guides-and-tutorials/nodes-and-miners/run-a-node-with-digital-ocean.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Testing Smart Contracts
2+
3+
Smart contracts are immutable once deployed. Bugs are permanent. Test them
4+
thoroughly.
5+
6+
This section covers testing Clarity contracts.
7+
8+
- **Fuzz Testing**: Use Rendezvous to hammer your contract with random
9+
inputs. It helps expose edge cases and vulnerabilities.
10+
11+
More guides will follow.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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

Comments
 (0)