Testing Guide
Overview
Test Structure
test/
├── Deposit.t.sol # Deposit function tests
├── Transact.t.sol # Private transaction tests
├── Withdraw.t.sol # Withdrawal tests
├── MerkleTree.t.sol # Merkle tree logic tests (TODO)
├── Integration.t.sol # End-to-end tests (TODO)
└── mocks/
└── MockSP1Verifier.sol # Mock verifier for testingRunning Tests
Run All Tests
forge testRun Specific Test File
forge test --match-path test/Deposit.t.solRun Specific Test Function
Run with Verbosity
Run with Gas Report
Unit Tests
Deposit Tests
Transaction Tests
Withdrawal Tests
Integration Tests
End-to-End Flow Test
Fuzz Testing
Deposit Fuzz Test
Invariant Testing
Invariant: Total Supply Conservation
Gas Benchmarking
Create Gas Report
Optimize Gas Usage
Coverage Analysis
Generate Coverage Report
Detailed Coverage
Security Testing
Static Analysis with Slither
Mythril Analysis
Aderyn Analysis
Continuous Integration
GitHub Actions Workflow
Test Checklist
Common Test Patterns
Expect Revert
Expect Event
Time Manipulation
Prank (Impersonate)
Troubleshooting
Test Fails with "Out of Gas"
Mock Verifier Not Working
Events Not Emitted
Next Steps
Last updated