It is posible to configure android-junit5 for Unit Testing? #331
Replies: 1 comment
-
It is absolutely possible to use JUnit 5 for unit testing with this plugin. In fact, this has been the case since day 1, and it's the support for instrumentation tests that only came in recent years! Sorry if the readme didn't make this clear enough, but you can definitely use this for unit tests. Apply the plugin to your Android module as per the setup instructions and you're good to go! Now, about Robolectric, that's a different story... Because of the unique way that Robolectric injects its own variant of Android, we had problems for the longest time to support these tests with JUnit 5. But there are huge advancements right this moment where we are going to ramp up support for Robolectric. For more info and background, you can follow this thread over on the issues board. In summary, I'd still recommend you write Robolectric-based stuff against the JUnit 4 API, and write all other unit tests against the JUnit 5 API. They can coexist in the same codebase without any problems if you add the vintage engine to your dependencies. Again, the readme has you covered. |
Beta Was this translation helpful? Give feedback.
-
It is posible to configure android-junit5 for Unit Testing?
I see currently is possible only for Instrumentation Tests (UI Tests), but how about the unit tests?.
I know probably is not possible due to the Android Env required for it, however I was thinking getting rid of Robolectric in favor of this and I haven't been able to achieve it for Unit Testing.
Thanks in advance for any reply.
Beta Was this translation helpful? Give feedback.
All reactions