I have a set of apps, each with associated test case instrumentation. I'm launching the instrumentation programmatically from yet another "launcher" app (implemented as a service), using startInstrumentation()
as in this example: https://stackoverflow.com/a/9815087/1536475
This works just fine for launching one test case.
What I would like is for the launcher to run test case 1, wait for the test to complete, then run test case 2. What's holding me back is that startInstrumentation()
returns immediately and I don't know how to wait for test case 1 to complete before starting test case 2.
I'm hoping to find a solution more elegant than modifying the test case to somehow communicate its completion back to the launcher (e.g., test case broadcasts a message).
I'd just like the launcher to see that the test case has completed and know it's safe to proceed with the next one.
Thanks!