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

Catch up on JUnit 4 Runner support for custom ClassLoaders #1680

Closed
rmannibucau opened this issue Nov 15, 2018 · 5 comments
Closed

Catch up on JUnit 4 Runner support for custom ClassLoaders #1680

rmannibucau opened this issue Nov 15, 2018 · 5 comments

Comments

@rmannibucau
Copy link
Contributor

rmannibucau commented Nov 15, 2018

Runners in JUnit 4 were a great way to control the test environment and instance from user land (without writing an engine).

It would be great if JUnit Jupiter would allow one to do the same.

The main challenge is controlling the test instance redefining a custom @Test.

@rmannibucau rmannibucau changed the title Catch up on Junit 4 runner Catch up on Junit 4 runner: custom test instance Nov 15, 2018
@sormuras
Copy link
Member

Does the TestInstanceFactory extension point already help your use-case?

@sormuras
Copy link
Member

What about the TestInstancePostProcessor extension?

@rmannibucau
Copy link
Contributor Author

rmannibucau commented Nov 15, 2018

the processor is way too late (the instance exists so it does not help at all), test instance factory works (but requires the last release, i was on the 5.3.0-M1) but can likely be enhanced to be supported per test and not only globally (the API is not called when defined on a test method)

thanks for the heads up anyway, wouldnt have noticed the bad version otherwise

edit: the instance factory has the issue to require the produced instance to match the testClass - likely for the later reflection - so i can't produce it with another classloader. What i want to do is just:

  1. change the TCCL
  2. get a test instance using this new loader
  3. ensure the @test pass (ie the method is looked up in the instance created at 2)

@sbrannen sbrannen changed the title Catch up on Junit 4 runner: custom test instance Catch up on JUnit 4 Runner support for custom test instances Nov 25, 2018
@sbrannen
Copy link
Member

@rmannibucau, based on your latest feedback, I am closing this as a duplicate of #201.

Feel free to participate in the discussion in #201.

@sbrannen sbrannen changed the title Catch up on JUnit 4 Runner support for custom test instances Catch up on JUnit 4 Runner support for custom ClassLoaders Nov 25, 2018
@rmannibucau
Copy link
Contributor Author

Oki, i will just note that willing to handle all particular cases instead of providing a generic API as junit4 was is going to be a lot more complex and less powerful even if the api is a bit more fun so probably time to rationalize junit5 instead of fixing cases one by one.

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