-
Notifications
You must be signed in to change notification settings - Fork 1
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
LD-124 Add robolectric tests support #142
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Snapshot testing result: ✔️ |
🦙 MegaLinter status: ✅ SUCCESS
See detailed report in MegaLinter reports |
jacek-marchwicki
force-pushed
the
robolectric
branch
from
October 13, 2023 09:53
c4faf1c
to
edcf058
Compare
jacek-marchwicki
force-pushed
the
robolectric
branch
from
October 13, 2023 10:56
9858156
to
495e6df
Compare
nowakweronika
approved these changes
Oct 16, 2023
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.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Why?
androidTests are very useful, they are executed on real devices and those tests ensures that app works on user devices. Unforuntelly those tests are slow to execute. Running the full test suite takes time, and requires having emulator.
There is an alternative for androidTests wich is Robolectric tests. Those tests uses the same espresso/androidx test framework, but are executed on local machine, not on device. Those tests are much faster.
What problems can be detected by given test suite
This leads to conclustions, that we have a piramide of test suite, that no of tests looks like this:
What is greatest is that Robolectric and Android Tests uses the same framework for testing which mean, we can write the same test once and run them once with Robolectric framework, once with Android Emulator.
I.e. for quick feedback, after developing a feature with a test. We can firstly ensure that given test runs in Robolectric environemnt with very quick feedback loop. Then run it on Android Emulator for a little bit slower feedback loop. Then Run the whole Robolectric test suite on our machine for quick feedback loop of the whole test suite. After this, we can push to CI to run the while test suite on Android Emulators to ensure if there is no regression on real devices.
What?
AndroidComposeTestRule.registerIdlingResource
which is not supported by robolectric to waitUntil syncrhonization waitUntilLinks to related issues
Documentation
Notes
Robolectric doesn't support
AndroidComposeTestRule.registerIdlingResource
so we need to wait differently for loading to finish.Checklist