How to elegantly wait for test case to finish after call to startInstrumentation

喜你入骨 提交于 2019-12-10 22:08:48

问题


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!

来源:https://stackoverflow.com/questions/13229606/how-to-elegantly-wait-for-test-case-to-finish-after-call-to-startinstrumentation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!