android / android/android-test
Behavior difference between Espresso.registerIdlingResources and IdlingRegistry.register
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 342
- Avg merge
- 11h 29m
- Merged PRs (30d)
- 2
Description
### Description
After this commit: https://github.com/square/RxIdler/commit/643036417fc5f4f4514f60b98b01e7b60064f69a, a behavior change was observed in the Espresso lifecycle, particularly that IdlingRegistry no longer sets registerIdleTransitionCallback. More details here: https://github.com/square/RxIdler/issues/20
### Steps to Reproduce
For our use case, we migrated from Espresso 2.2.2 and 3.1.0 and switched from using `Espresso.registerIdlingResources` to `IdlingRegistry.register`.
### Expected Results
Expected tests to run as normal
### Actual Results
Tests crash with a NullPointerException, due to a missing callback. That callback used to be set earlier in the lifecycle via this method: https://github.com/android/android-test/blob/master/espresso/idling_resource/java/androidx/test/espresso/IdlingResource.java#L59
### AndroidX Test and Android OS Versions
3.1.0
### Link to a public git repo demonstrating the problem:
https://github.com/square/RxIdler/issues/20
A community member has provided [a fix which will unblock users](https://github.com/square/RxIdler/pull/28), but I would like to confirm whether this lifecycle change is intended behavior or a regression. Put another way: when should a callback be expected to be non-null?
Contributor guide
Research direction
Start by comparing Espresso.registerIdlingResources with IdlingRegistry.register and inspect the callback contract in IdlingResource.java. Reproduce the NullPointerException using the scenario described in RxIdler issue 20, then compare the behavior with the proposed fix in RxIdler pull request 28. Done means establishing whether the lifecycle change is intended or a regression and identifying the required follow-up.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile, testing-qa
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100