-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Provide a cleaner way to write parametric tests #2414
Comments
The I suppose something like Let's leave this open for now for others to chime in. |
But you have macros for that, just create a single macro and re-use it. |
maybe someone ought write a recipe for that and slap it in the docs. |
@novemberborn Has this been fixed? Or a recipe added to the docs? Or is the final resolution a "wont fix"? |
Hey @Peque, per #2414 (comment) I don't think we'll be adding this to AVA. Always open to link to examples or have a recipe, but IMHO it's not worth keeping this issue open for that. |
I went ahead and published pava, which provides a simple utility for writing parameterized tests in ava! |
@TomerAberbach nice, you should add it to https://github.com/avajs/awesome-ava! |
Having a function like:
I would like to create multiple tests with multiple combinations of
a
andb
.Currently, I can do so by "brute force":
Or perhaps even better by using a
for
loop:It would be great to have a simple/clearer way to write this.
In Python, with the
pytest
framework, I can do:I think it is a great example. Note how I can define a list of possible values for each variable and how the name of the variable is assigned to the expected parameter in the test. The combinations are handled by the framework, so I do not need to create a list "by hand" to use in a
for
loop.It also allows you to do something like (for other use cases):
The text was updated successfully, but these errors were encountered: