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

Update example to be consistent with robolectric.org #7475

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

seadowg
Copy link
Collaborator

@seadowg seadowg commented Jul 31, 2022

As requested, update the README example based on the docs changes in robolectric/robolectric.github.io#115.

@@ -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)
Copy link
Member

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?

Copy link
Contributor

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.

Copy link
Collaborator Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hoisie I agree with @seadowg thought. Maybe we can add new commits to add special examples with AndroidJUnit4.

Copy link
Collaborator Author

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?

Copy link
Collaborator Author

@seadowg seadowg Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But @hoisie has different opinion about switching AndroidJUnit4 to RobolectricTestRunner.

Is this coming from a discussion outside this thread? @hoisie hasn't replied to my initial comment.

Copy link
Member

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seadowg Sorry for delaying response. Current state looks great to me. But it needs @hoisie review suggestions.

@seadowg seadowg requested review from hoisie and utzcoz August 1, 2022 19:08
@utzcoz
Copy link
Member

utzcoz commented Sep 19, 2023

@hoisie @seadowg I think we can discuss this PR again. After long time, and a short recapping, I prefer to keep two samples: the sample with RobolectricTestRunner and the sample with AndroidJUnit4 and with AndroidX test dependency requirements.

@seadowg
Copy link
Collaborator Author

seadowg commented Sep 26, 2023

I prefer to keep two samples: the sample with RobolectricTestRunner and the sample with AndroidJUnit4 and with AndroidX test dependency requirements.

That would make sense to me! We could add the AndroidX dependency requirements to https://robolectric.org/androidx_test/.

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

Successfully merging this pull request may close these issues.

None yet

3 participants