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

No runner equivalent #1239

Closed
rmannibucau opened this issue Jan 12, 2018 · 4 comments
Closed

No runner equivalent #1239

rmannibucau opened this issue Jan 12, 2018 · 4 comments

Comments

@rmannibucau
Copy link
Contributor

What was nice with runners was to be able to delegate a class model logic to another runner and inherit from a full lifecycle. With JUnit 5 the extensions don't allow that and enforces you to integrate in the existing lifecycle which is a lot of work for custom @test.

Only alternative is an engine but is too impacting in terms of setup for end users.

@sbrannen
Copy link
Member

Hi @rmannibucau,

We don't have any plans to support the Runner API from JUnit 4 in JUnit Jupiter.

Instead, the extension model for JUnit Jupiter is built on the concept of composable extensions.

Thus, if you have concrete proposals for new extension APIs in JUnit Jupiter, please open a new issue (or issues) with your proposals and we would be happy to discuss them.

Thanks!

@sbrannen
Copy link
Member

Closing this issue as invalid since the JUnit 4 Runner API is not supported in JUnit Jupiter.

@rmannibucau
Copy link
Contributor Author

rmannibucau commented Jan 12, 2018

@sbrannen it is not about supporting runners but the same feature. How can I use a custom execution logic not based on @testable?

Here is the junit4 flavor: https://github.com/Talend/component-runtime/blob/master/component-runtime-testing/component-runtime-junit/src/main/java/org/talend/sdk/component/junit/delegate/DelegatingRunner.java

it allows to inherit from the testing model of the referenced runner and decorate it with several features, including executing the full test class (means beforeall, before each, test, after each, after all) N times, whereas JUnit 5 only allows to do it for tests and not the full lifecycle. This is impacting cause you can't recycle as much the resource (for each case).

See repeatead test for instance, you execute the test N times but you cant have a beforeall/afterall or all tests done with the same setup at once.

What i'd like to achieve is:

Run #1 (system.setproperty("foo", "1"):
before all
before each
test1
after each
before each
test2
after each
after all
Run #2 (system.setproperty("foo", "2"):
before all
before each
test1
after each
before each
test2
after each
after all

if the init/clear is impacting (classloader, caching, init of a database etc...) this last lifecycle is better than:

before all
Run #1 (system.setproperty("foo", "1"):
before each
test1
after each
Run #2 (system.setproperty("foo", "2"):
before each
test1
after each
Run #1 (system.setproperty("foo", "1"):
before each
test2
after each
Run #2 (system.setproperty("foo", "2"):
before each
test2
after each
after all

@marcphilipp
Copy link
Member

This will become possible once #871 is implemented which we intend to do for 5.2.

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

3 participants