Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow parameterization of tests across a predefined array of values #2329

Closed
5 tasks
ckoopmann opened this issue Jul 15, 2022 · 1 comment
Closed
5 tasks
Labels
T-feature Type: feature

Comments

@ckoopmann
Copy link
Contributor

ckoopmann commented Jul 15, 2022

Component

Forge

Describe the feature you would like

It'd be great if the user was able to run a test or even a whole collection of tests across a chosen set of input values.
(Note that this is different from fuzz testing across random values).

Example use cases:

  • Run tests across different address inputs. (Different Token Addresses, Contract Owner vs. non-owner, Contract vs. EOA etc)
  • Run a set of tests both before and after the upgrade of a contract

The feature would ideally allow the user to:

  • Parameterize a single test
  • Parameterize a whole test collection (contract)
  • Specify multiple parameters in which case the test(-collection) will be run for all combinations
  • Set the values to parameterize dynamically (for example in the setUp method) (optional)
  • Pass filter arguments to forge test to only run a subset of the originally specified parameter space (similar to --match-test

Additional context

One testing library that does this fairly well imo is pytest (see here).

@ckoopmann ckoopmann added the T-feature Type: feature label Jul 15, 2022
@gakonst gakonst added this to Foundry Jul 15, 2022
@gakonst gakonst moved this to Todo in Foundry Jul 15, 2022
@onbjerg
Copy link
Member

onbjerg commented Jul 15, 2022

I'd argue this is a duplicate of #858, so I'm closing this as such - please let me know if the feature outlined in #858 is not the same as this 😄

@onbjerg onbjerg closed this as completed Jul 15, 2022
Repository owner moved this from Todo to Done in Foundry Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-feature Type: feature
Projects
Archived in project
Development

No branches or pull requests

2 participants