Skip to content

Value of ElapsedTimeIdlingResource? #9

@RobertLK

Description

@RobertLK

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions