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

JUnit 5: How to support dynamic tests? #280

Open
janschaefer opened this issue Dec 26, 2016 · 4 comments
Open

JUnit 5: How to support dynamic tests? #280

janschaefer opened this issue Dec 26, 2016 · 4 comments

Comments

@janschaefer
Copy link
Contributor

It is unclear at the moment how dynamic tests should by supported by JGiven, as JUnit 5 provides no life-cycle hooks for them. Any suggestions are welcome!

@ahus1
Copy link
Contributor

ahus1 commented Jan 2, 2017

Suggestion No 1: open a bug with JUnit5 :-) but maybe suggestion No 2 could allow to explore some scenarios first to make a point.

Suggestion No 2: I had cases where I wrapped lambdas with a static function. It would look like this:

dynamicTest("1st dynamic test", wrapForJGiven(() -> assertTrue(true)))

JGiven could first prepare whatever is necessary, then call the lambda, and afterwards clear up after the lambda. This could offer some basic lifecycle handling. But I how would you take it from here? But I see that you might want to grab the first parameter "1st dynamic test", wouldn't you?

@janschaefer
Copy link
Contributor Author

Maybe JGiven could provide a method dynamicJGivenTest that is just a wrapper around dynamicTest. That might even be easy to implement.

@ahus1
Copy link
Contributor

ahus1 commented Jan 2, 2017

Like that - and you can capture the first argument as well.

@janschaefer
Copy link
Contributor Author

PR #289

@janschaefer janschaefer added this to the Backlog / Unplanned milestone Mar 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants