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

Value of ElapsedTimeIdlingResource? #9

Open
RobertLK opened this issue Aug 17, 2018 · 2 comments
Open

Value of ElapsedTimeIdlingResource? #9

RobertLK opened this issue Aug 17, 2018 · 2 comments

Comments

@RobertLK
Copy link

Been thinking a lot about this recently because I've seen it in a few projects and I'm struggling to see what it offers over a simple Thread.sleep. The only context I can find is this blog post, which simply states "We could use SystemClock.sleep(60000), but that blocks the testing thread.". This is a strange justification since IdlingResources cause onView and onIdle to block the testing thread and this is wanted and expected behaviour for test code (tests are always run synchronously).
As far as I can tell using this IdlingResource is identical to using a sleep from a thread execution standpoint, but the code is more verbose and harder to understand. This seems to me like a misuse of IdlingResource and a testing anti-pattern, and it seems to be used in many codebases where a sleep would be simpler. Please let me know if there's some other execution property that makes this implementation advantageous.
Thanks.

@chiuki
Copy link
Owner

chiuki commented Aug 17, 2018

I agree with you. I wrote ElapsedTimeIdlingResource mostly as an exercise to understand how idling resources work, and there is no real use case. I wish I can retract it but it's been a few years so I'm not sure what's the best way to deal with it.

@RobertLK
Copy link
Author

RobertLK commented Aug 19, 2018 via email

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

No branches or pull requests

2 participants