Skip to content

Cyfrin/fuzz-testing-on-foundry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Foundry Fuzz and Invariant Testing

Overview

This repository is dedicated to demonstrating and implementing fuzz and invariant testing using Foundry, a powerful Ethereum development framework. Foundry allows for extensive testing of smart contracts, enabling developers to catch bugs and ensure contract robustness. The focus of this repository is on leveraging Foundry's capabilities for fuzz testing and invariant testing of smart contracts.

Fuzz Testing

Fuzz testing in Foundry involves automatically generating a wide range of inputs to test functions in smart contracts. This method helps in uncovering edge cases and ensuring that the contract behaves correctly under various scenarios.

Invariant Testing

Invariant testing is about defining certain conditions or invariants that should always hold true for the state of the contract, regardless of the actions performed on it. These invariants are then tested to ensure they hold under different conditions and actions.

Getting Started

Prerequisites

Running Tests

  1. Clone the Repository: Clone this repository to your local machine using Git.
git clone <repository-url>
  1. Navigate to the Repository Directory: Change your current working directory to the repository folder.
cd path/to/repository
  1. Run Foundry Tests: Execute the following command to run the tests using Foundry.
forge test

Contributing

Contributions to enhance the fuzz and invariant testing examples are welcome. Please feel free to fork the repository, make your changes, and create a pull request.

About

Simple Smart contracts to showcase Fuzz and Invariant testing on Foundry.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published