When you run forge test --match-case testFunction it works even without parameters. Why? Do I have to input them?

    function testFunction(
        uint64 poolId,
        string memory tokenName,
        string memory tokenSymbol,
        bytes16 trancheId
    ) public {

  • It automatically uses parameters, that's called fuzz testing . Sep 11, 2023 at 11:32

1 Answer 1


If you do not provide arguments to your test function then it will only run once.

If you provide arguments it will run multiple times with many different variables that's the fuzz testing functionality of Foundry.


If you want to change the number of runs you can add:

runs = 256

in your foundry.toml file

  • How is it possible to run when there are no arguments passed into the parameter? Sep 13, 2023 at 7:14
  • Like i said eveything is explained in the docs even with examples. If you provide arguments to the test function then those arguments will be fuzzed; function testFunction(address _randomAddress) public { ERC20.balanceOf(_randomAddress); } Will run the balanceOf function for 256 different addresses. Otherwise you jut have to provide the address yourself.
    – Torof
    Sep 13, 2023 at 8:42
  • If I do want to customize my function testFunction, I have to call another function and input the parameter? Sep 13, 2023 at 9:01
  • Please read the official documents, everything is explained. Here is a forum to answer question when one is stuck, it is not a tutorial platform. If my answer was useful to you , you can upvote it.
    – Torof
    Sep 13, 2023 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.