Skip to content
New issue

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

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

Already on GitHub? # to your account

Is there a corresponding concept of JUnit4's @Parameters #505

Closed
PeterWippermann opened this issue Sep 9, 2016 · 5 comments
Closed

Is there a corresponding concept of JUnit4's @Parameters #505

PeterWippermann opened this issue Sep 9, 2016 · 5 comments

Comments

@PeterWippermann
Copy link

In JUnit 4 tests could be run as Parameterized. These test class had to define a method annotated with @Parameters. This method would return a set of parameters and the tests in the test class would be executed for every tuple of parameters. Do we have the same concept in JUnit 5?

I understand that with the Extensions API I can either define a TestPostProcessor or a ParameterResolver. But none of these will allow me do run the same test cases for different parameters, do they?

Should I rather use a @TestFactory for this purpose?

@schauder
Copy link
Contributor

schauder commented Sep 9, 2016

You are correct in your analysis: @TestFactory is the tool to use for this use case.

@sbrannen
Copy link
Member

sbrannen commented Sep 9, 2016

@schauder is correct: for the time being, @TestFactory is your only choice.

However, JUnit Jupiter will eventually support some form of parameterized tests. See #14, #371, and #276.

@sbrannen
Copy link
Member

sbrannen commented Sep 9, 2016

Closing this issue as a duplicate.

@PeterWippermann
Copy link
Author

I had a look into TestFactory and it doesn't really work for me. The drawbacks of DynamicTests (e.g. there's no integration with @BeforeEach ) and the need for parameterized tests have already been discussed in other issue tickets (I wasn't aware of these when opening this issue), so I'll stay tuned for updates there.

@marcphilipp
Copy link
Member

Rest assured, we're working on it! We plan to address this in the next milestone release.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

4 participants