-
Notifications
You must be signed in to change notification settings - Fork 314
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 support #224
Comments
Thanks for the report. We have JUnit5 support on our roadmap, but to be honest its not a super high priority at the moment in comparison to other features. However, we have been thinking about JUnit5 and other test frameworks when planning future APIs. In general, we're trying to make new APIs test-framework agnostic by default. For example: androidx.test.core.ActivityScenario exists as a 'core' API without any JUnit dependencies. All the meaty logic for testing Activities is contained within this API, which will be officially replacing ActivityTestRule in a future release. The hope is then that in the future, it would be easier for us or contributors to create simple wrappers for test framework specific extensions. Like we've done for JUnit4 in androidx.test.ext.junit.rule.ActivityScenarioRule. I haven't used JUnit5 much myself but from brief reading it looks like 'extensions' are the equivalent to Junit4 Rules? So for example, someone could hopefully easily create a JUnit5 ActivityScenarioExtension that calls launch() and close() before and after each test. |
Yes, exactly. |
Mind you that JUnit 4.13 is almost released, but I agree Jupiter is way more awesome.
it would be nice to have first party support, if it's so easy I don't see why not |
Any update on a timeline for official JUnit 5 support? This really seems like something that should be supported natively without the need for a 3rd-party plugin. |
Any updates? Plans? |
👋 Welcome to 2021. Could it be possible to be updated on this? |
Any native/official JUnit 5 support for Android (no 3rd part library) ???? |
You don't seem to have the resources to that massive scope of supporting all possible testing frameworks. Anyway, I'm migrating to KoTest, so it doesn't matter anymore, as mannordemaus binding is enough to make the basics of JUnit5 run. |
Would love native JUnit5 support, please make it happen |
welcome to 2022 |
Come on, Google, you only had THREE years to implement this. |
Here is a related Stack Overflow post: JUnit 5 for Android testing |
Thanks, I got it working. But it would be cool to not need an additional plug-in for this... |
I hear the following sentence almost every year on Google I/O: "We listen to our developers!". Well, I would really like Google to listen to us on this one. |
(@brettchabot, just in case, please look at this query when prioritizing based on community feedback.) |
I hope that testing on Android will get one day the same love as Compose and all other opinionated architectural guides... |
JUnit5 support has been in the roadmap since its release, but our developer surveys consistently rank this below other features to invest in, such as testing support in Compose, Gradle Managed Devices or Automated Test Devices. We appreciate the feedback and we're aware some developers feel very strongly about this (in favor and against) but please remember to keep the discussion respectful and helpful. |
Thanks, the team is aware and it's why it's in the roadmap. |
@JoseAlcerreca are those "other" features also the same team as the one that works on Espresso/JUnit runner? I would have thought that Compose testing is Compose UI team's responsibility, GMD is part of AGP, and ATD is done by a team that deals with Android SDK and emulators. |
@JoseAlcerreca What can we do to make this happen? |
Yes, the testing team is involved one way or another in all those projects.
To clarify this, Brett was referring to the creation of an ActivityScenarioExtension, not talking about a full migration to JUnit5. This would be a non-trivial undertaking, including years of releasing and maintaining junit4 and junit5 artifacts, starting with the runner and dealing with API breakages. I haven't used the 3p gradle plugin. It looks like it only works on API 26 and newer. Are there any other limitations? |
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as outdated.
This comment was marked as outdated.
So this issue is open for over 3 years now .... is there any way to see what priority JUnit 5 support actually has? Right now I am not being able to even guess when this might be available. |
Welcome to 2023. Any plans on adding this? |
Is it time? |
Please add support JUnit5 |
April 2023, still waiting. |
Does anybody know if jetpack Compose has an offical statement about current situation with JUnit5 (or anyhwere that states that they currently dont support JUnit5) |
Its mid 2023. any update? |
The ComposeTestRule is a JUnit4 rule. There's no support for JUnit5. |
But I guess you test compose only in jvm, there you can use the test framework you prefer. |
I've had success using https://github.com/mannodermaus/android-junit5. |
Needs some additional plugins, because Google isn't moving on JUnit 5 support see - Google tracking issue: android/android-test#224 - Android <-> JUnit 5 plugin https://github.com/mannodermaus/android-junit5 - StackOverflow answer about the plugin https://stackoverflow.com/questions/46161113/junit-5-for-android-testing
Our very first unit tests! Needs some additional plugins, because Google isn't moving on JUnit 5 support. see - Google tracking issue: android/android-test#224 - Android <-> JUnit 5 plugin https://github.com/mannodermaus/android-junit5 - StackOverflow answer about the plugin https://stackoverflow.com/questions/46161113/junit-5-for-android-testing
Our very first unit tests! Needs some additional plugins, because Google isn't moving on JUnit 5 support. see - Google tracking issue: android/android-test#224 - Android <-> JUnit 5 plugin https://github.com/mannodermaus/android-junit5 - StackOverflow answer about the plugin https://stackoverflow.com/questions/46161113/junit-5-for-android-testing
Welcome to 2024. |
Hello to 1403 |
One of the biggest advantage for us having Junit5 support is that we have a BFF written in Kotlin+Spring Boot. And it uses Junit 5. It's been a huge pain for us to do context switching between 4 and 5. We have a community plugin yes, but still it's missing feature like hilt injection, robolectric etc. Would be nice for Google to work on these extensions for us. |
JUnit4 is the old JUnit system that was last updated way back in 2014. JUnit5 brings many new improvements, but at the moment it is tough to use it on Android.
There is 3rd party gradle plugin that supports JUnit5: https://github.com/mannodermaus/android-junit5 and while it works fine, it especially lacks in UI rules like in ActivityRule or ServiceRule (All official rules are for JUnit4, so they have to be rewritten if one wants to use JUnit5 for instrumentation tests).
(Copied from https://issuetracker.google.com/issues/127100532)
The text was updated successfully, but these errors were encountered: