I use IdlingResource to synchronize several network related tasks. I register and release idlingresource in @Before and @After . AndroidJUnitRunner .
The basic sequence of steps:
- Espresso clicks a button that makes a network request
- When I get a response, the espresso presses another button that starts a new action.
- Make more network requests with a new action.
What actually happens is that the first network request is completed, but the new activity is not running. I have a feeling that the main thread is looping somewhere, but I can’t pinpoint it.
When I run one test (right click method, click “Run test method ..."), it works, but when I try to execute all the testing methods in the class, it fails.
The cool thing is, even if every method is empty, except for the one that actually does the user interface testing, it still doesn't work.
A similar question is in this topic, but there is no answer: Espresso 2 on Android, intermediate tests fail after the activity being tested is not started, and the actions of previous tests are still alive
Any help would be appreciated.
source share