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
Update example to be consistent with robolectric.org #7475
base: master
Are you sure you want to change the base?
Conversation
@@ -12,18 +12,18 @@ Robolectric supports running unit tests for *16* different versions of Android, | |||
Here's an example of a simple test written using Robolectric: | |||
|
|||
```java | |||
@RunWith(AndroidJUnit4.class) | |||
@RunWith(RobolectricTestRunner.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@seadowg What about keeping using AndroidJUnit4
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'd also recommend using AndroidJUnit4 by default as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with RobolectricTestRunner
to keep it consistent with http://robolectric.org/. I had switched away from using AndroidJUnit4
on the website because using that runner requires also having androidx.test.ext:junit
as a dependency.
Personally, I like the idea of having Robolectric docs focus on Robolectric in isolation and then have extra docs that describe using it as part of AndroidX Test (like http://robolectric.org/androidx_test/ and Android official docs).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any update on the thinking here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'd also recommend using AndroidJUnit4 by default as well.
@seadowg This one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay in replying @utzcoz! I'm happy to wait for a reply from @hoisie to my follow-up on that if we're not happy to merge on the single approval:
I went with RobolectricTestRunner to keep it consistent with http://robolectric.org/. I had switched away from using AndroidJUnit4 on the website because using that runner requires also having androidx.test.ext:junit as a dependency.
I think we'll end up repeating these points in a new PR otherwise, and I don't think the change to try-with-resources
is high priority enough to need to get through now seeing as we've already made the change to the website.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any update on this? If it's still preferred that we use AndroidJUnit4
as the runner in examples, then I'd suggest we also add androidx.test.ext:junit
as a dependency in the "Starting a New Project" section. Happy to go with that if it'd make more sense to everyone!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would make sense to me! We could add the AndroidX dependency requirements to https://robolectric.org/androidx_test/. |
As requested, update the README example based on the docs changes in robolectric/robolectric.github.io#115.