-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Update example to be consistent with robolectric.org #7475
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
Conversation
README.md
Outdated
|
|
||
| ```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.
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.
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.
Hey sorry for not getting back to this. We should keep it as 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.
Great! I've updated the build.gradle example to include the dependency needed for AndroidJUnit4 as well then.
That would make sense to me! We could add the AndroidX dependency requirements to https://robolectric.org/androidx_test/. |
|
@hoisie @utzcoz any update on this? The example in |
|
@hoisie any chance you can look at this if it's required? As far as I can tell, the example in the If it's controversial which runner to use here, maybe we could just remove the example and link to the doc at robolectric.org (https://robolectric.org/getting-started/) as they seem to be staying relatively up to date. |
|
Just wanted to bump this again as the mistakes being corrected here have bled into the new official Android Robolectric docs (here). I'll file a docs issue as well, but you can see that the dependency setup wouldn't work with the example and the example uses an |
e5e0f53 to
e768257
Compare
|
@hoisie @utzcoz we'll now want to update https://robolectric.org as well to be consistent right? |
MGaetan89
left a comment
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.
One final typo, and then it should be good to merge.
Also can you squash your commits into one please?
Indeed, I guess it will make sense to use |
This replaces the use of RobolectricTestRunner and adds the dependencies needed to access AndroidJUnit4
MGaetan89
left a comment
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.
Thanks for keeping this up to date and your patience!
This change aligns the sample on the homepage with what has been done in robolectric/robolectric#7475
This change aligns the sample on the homepage with what has been done in robolectric/robolectric#7475
This change aligns the sample on the homepage with what has been done in robolectric/robolectric#7475
Closes #10275
As requested, update the README example based on the docs changes in robolectric/robolectric.github.io#115.