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

Corrections regarding JUnit Jupiter parameterized test support #3

Closed
sbrannen opened this issue Mar 18, 2018 · 4 comments
Closed

Corrections regarding JUnit Jupiter parameterized test support #3

sbrannen opened this issue Mar 18, 2018 · 4 comments
Assignees

Comments

@sbrannen
Copy link

First and foremost, this looks like an interesting test framework, and it's always cool to see people implementing their own TestEngine for the JUnit Platform!

I read through the README and noticed a few points regarding JUnit Jupiter's support for parameterized tests which are technically incorrect.

So I'd be grateful if you could reword the following sections.

Thanks in advance!


  • The support for parametrized tests with JUnit5 is quite limited: the parameters need to be known upfront and stored in annotations, that restricts you from:

Parameters actually do not need to be known up front. They can be loaded from any source of your choosing dynamically and programmatically. You can implement a custom ArgumentsProvider or use a @MethodSource that receives parameters that are dynamically supplied by a factory method.

One can of course choose to use an annotation such as @ValueSource to define static parameters, but that is not the only choice.

  • Having the parameters created dynamically or loaded from a file;

So you could generate the parameters dynamically, load them from a file, read them from a database, etc. The world is your oyster. 😉

  • Using more complex types - you are restricted to String and primitives.

There are literally zero restrictions on parameter types when using a @MethodSource or custom ArgumentsProvider.

@mvysny mvysny self-assigned this Mar 18, 2018
@mvysny
Copy link
Owner

mvysny commented Mar 18, 2018

First and foremost, this looks like an interesting test framework, and it's always cool to see people implementing their own TestEngine for the JUnit Platform!

Thank you :) Yet the credit goes to the JUnit team since you guys made this possible by introducing the JUnit Platform.

Thank you for pointing out the irregularities in the documentation. You're right; the parameter system in JUnit is more powerful than I thought. I need a bit of time to study it more; I'll then post the documentation proposal here and we can discuss.

I'm trying to prototype a builder-based testing tool as opposed to traditional annotation-based tool; yet I probably fail to express the disadvantages I see with the annotation-based approach.

@mvysny mvysny closed this as completed in d92999a Mar 19, 2018
@mvysny
Copy link
Owner

mvysny commented Mar 19, 2018

I played with the @MethodSource and I have to admit I was wrong. I've decided to remove the whole paragraph. Please feel free to review and reopen this bug if something else is off as well.

@sbrannen
Copy link
Author

Sounds good!

Thanks for making the change.

FYI: we are also considering adding support for "parameterized test classes" in an upcoming release of JUnit Jupiter. Details here: junit-team/junit5#878

@sbrannen
Copy link
Author

Thank you :) Yet the credit goes to the JUnit team since you guys made this possible by introducing the JUnit Platform.

😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants