leave Android app in final state on espresso test

2019-04-11 22:00发布

问题:

Is it possible to leave the app under test in whatever state it's in at the end of an espresso test? I don't care if it's failure or success. When I am working on developing a feature and a test for said feature it would be useful to just have the instrumentation app stop and leave the app under test alone in whatever state it happens to be in. This would allow me to play around manually or attach a debugger and see what is going on without running through the entire flow manually.

Anyone know if this is possible?

回答1:

There are multiple actors in play that try to kill your activities... finally I had to provide a custom rule and a custom runner to get the behavior I wanted. Documented here:

https://gist.github.com/dbachelder/4d0588ab6adf0aa6e69a