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
Real JUnit 5 support (via extension API) #3477
Comments
Duplicate issue - #3397. |
@bangarharshit I took the liberty of renaming #3397 to scope that issue to make Robolectric tests work in legacy mode (tests run by the JUnit5 vintage runner) which should be more prioritized so that people can start migrating to JUnit5 (mixed JUnit4&5 tests). IMO this issue is about "real" JUnit5 support (tests run by the JUnit5 jupiter runner) which means implementing the JUnit5 extension API. |
FYI Gradle 4.6 is out which supports JUnit Platform out of the box so we can now run JUnit 5 tests in Android projects without any 3rd party plugins. |
Any news about making Robolectric works with JUnit5? |
@xian I think this is not possible until this issue junit-team/junit5#201 is resolved |
This converts all remaining tests to the JUnit 5 APIs and annotations. The only remaining test is the org.nypl.simplified.tests.webview.CookiesTest class as this uses RoboElectric which is currently incompatible with JUnit 5. See: robolectric/robolectric#3477 Affects: https://jira.nypl.org/browse/SIMPLY-3626
Just following up, is there a way to run JUnit 5 tests with robolectric currently? I see some merges occurred with JUnit5 support. |
I've tried to enhance the test instance creation with the Roboeletric Class Loading process in order to make the Android OS available via JUnit5 Extension Point. Fact is that Jupiter detects the difference of the instance. Other PoC failed as well since the migration is a very complex problem. I now understand that migrating this complete framework to JUnit5 will be a lot of pain. But since JUnit4 is very old, it should be considered in order to decrease tech dept. Even the performance of Jupiter is a good argument. |
Hi @utzcoz |
@Anish528 Thanks for interesting for this project. Could you create a new discussion at GitHub Discussion as other folks did for GSoC 2022? We can talk more about it before applying proceas without breaking discussion on this issue. |
Please link here. |
Sure will do Thanks! |
already 2023, is there any progress with the supporting of JUnit 5, it is already 6 years old? |
Nope, unfortunately there has been no progress on this issue, and I am not aware of anyone working on this at the moment. For several years now there has been a project on the backburner to decouple Robolectric from JUnit4, but that has not happened yet. |
6 years later, why isn't this fixed yet? |
@hoisie can we make something to make this a higher priority? Robolectric is now the only reason we must maintain both JUnit4 and JUnit5, and it's been like this for several years. Previously you could argue that JUnit5 doesn't have support for custom ClassLoaders, but it's not a case anymore. |
Is there any update? I don't wanna add junit4 to my project just for robolectric 😞 |
Any update or outlook on when we might expect a migration? |
Same issue here, 2024, happy new year! |
Can you run Robolectric with JUnit5 vintage engine? |
As far as I know, yes, but it's provided as a temporary migration path. |
Just to be clear and set expectations: While I personally think it would be great for Robolectric to have deep integration with JUnit5, this project is considered low priority and there is nobody I know actively working on it. I am personally focusing on other projects and initiatives. Unfortunately, for various reasons, JUnit5 is not widely used at Google. If JUnit5 support for Robolectric is important for people, I would warmly encourage someone to take a more active role in investigating and developing a possible solution. I'd be happy to provide support for this. |
I've created an experimental project to explore JUnit 5 integration. This project have limitations, but it can serve as a foundation for further collaboration: https://github.com/apter-tech/junit5-robolectric-extension |
This is fantastic work, @warnyul – I'm able to confirm that this does indeed work for a simple use case that I just spun up. Great job! |
@warnyul Thanks for your work. Could you send a PR for your work? We can discuss on your PR and land your work as much as possible. |
@utzcoz You mean as it is? I think in the Robolectric repo we could do more than what I did in my experiment. I just realized there was a GSOC project about JUnit5 support, but I missed the deadline. Is it feasible to complete this as a part of the GSOC program? It would be beneficial to talk about the process of decoupling Robolectric from JUnit 4. |
@warnyul Yeah. We can customize core Robolectric parts to make things easier if you want to support junit5 in Robolectric. This project is prepared for GSoC with two years, but no students want to take this project. So it's fine if you want to take this one and make some real progress for it. |
Currently there is no way to run JUnit 5 tests with robolectric. Are there any plans to introduce it or could someone sketch what would be needed for an integration so I could contribute the code.
The text was updated successfully, but these errors were encountered: