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

Real JUnit 5 support (via extension API) #3477

Open
joecks opened this issue Oct 25, 2017 · 29 comments
Open

Real JUnit 5 support (via extension API) #3477

joecks opened this issue Oct 25, 2017 · 29 comments
Milestone

Comments

@joecks
Copy link

joecks commented Oct 25, 2017

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.

@bangarharshit
Copy link

Duplicate issue - #3397.

@alixwar
Copy link
Contributor

alixwar commented Nov 6, 2017

@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.

@technoir42
Copy link

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.
It'd be great to have a JUnit 5 extension for Robolectric so we could use the awesome new @Nested and @ParametrizedTest.

@CoderSpinoza
Copy link

@alixwar I agree that this issue and #3397 should be separated. :) Is there a milestone set for this issue? Really wanna try out junit 5 (jupiter) with Robolectric in my project.

@olivierperez
Copy link

Any news about making Robolectric works with JUnit5?

@xian xian added this to the 4.1 milestone Nov 2, 2018
@xian xian changed the title JUnit 5 support Real JUnit 5 support (via extension API) Nov 2, 2018
@xian
Copy link
Member

xian commented Nov 2, 2018

@bangarharshit
Copy link

@xian I think this is not possible until this issue junit-team/junit5#201 is resolved

@xian xian modified the milestones: 4.1, backlog Dec 12, 2018
io7m added a commit to NYPL-Simplified/Simplified-Android-Core that referenced this issue Apr 8, 2021
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
@GaganBhat
Copy link

GaganBhat commented Jun 9, 2021

Just following up, is there a way to run JUnit 5 tests with robolectric currently? I see some merges occurred with JUnit5 support.

@ghost
Copy link

ghost commented Jan 4, 2022

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.

@Anish528
Copy link

Hi @utzcoz
I would like to explore this project JUnit 5 Support as part of the GSoC program.
Any advice or tips on how to get started would really help out!
Thanks.

@utzcoz
Copy link
Member

utzcoz commented Mar 19, 2022

@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.

@TWiStErRob
Copy link

Please link here.

@utzcoz
Copy link
Member

utzcoz commented Mar 19, 2022

There are three existing discussions about GSoC 2022 program: #7141, #7127 and #7128.

@Anish528
Copy link

@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.

Sure will do Thanks!

@VarenytsiaMykhailo
Copy link

already 2023, is there any progress with the supporting of JUnit 5, it is already 6 years old?

@hoisie
Copy link
Contributor

hoisie commented Apr 16, 2023

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.

@trevor-hackman-kr
Copy link

6 years later, why isn't this fixed yet?

@ILikeYourHat
Copy link

@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.

@MuhammadKhoshnaw
Copy link

Is there any update? I don't wanna add junit4 to my project just for robolectric 😞

@simvn
Copy link

simvn commented Nov 22, 2023

Any update or outlook on when we might expect a migration?

@victorpineda-jt
Copy link

Same issue here, 2024, happy new year!

@emartynov
Copy link

Can you run Robolectric with JUnit5 vintage engine?

@TWiStErRob
Copy link

As far as I know, yes, but it's provided as a temporary migration path.

@hoisie
Copy link
Contributor

hoisie commented Mar 27, 2024

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.

@warnyul
Copy link

warnyul commented Apr 30, 2024

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

@mannodermaus
Copy link

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!

@utzcoz
Copy link
Member

utzcoz commented May 3, 2024

@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.

@warnyul
Copy link

warnyul commented May 3, 2024

@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.

@utzcoz
Copy link
Member

utzcoz commented May 4, 2024

@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.

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