To illustrate my latest problem with writing JUnit tests for my Android app, I wrote a simple example with two activities, StartActivityForResult
and ChildAct
As illustrated in an answer to one of my related questions, the problem is that I am calling waitForMonitorWithTimeout()
on the UI Thread. After realizing this, it certainly makes complete sense because waitForMonitorWithTimeout()
waits for the UI thread to complete some action (namely displaying an Activity's UI). However, by calling it on the UI thread, I am delaying that action from occuring.