I’m doing some tests using ActivityInstrumentationTestCase2<> class. Sometimes I launch new Activities within my test so getActivity().finish() isn’t working to close current Activity which prevents further tests execution. Is there a way to get a reference to currently opened activity?
I’m doing some tests using ActivityInstrumentationTestCase2<> class. Sometimes I launch new Activities within my
Share
Have you tried using Robotium? It has some nice helpers for doing stuff like this, as well as a very convenient cleanup method that closes all the activities you might have opened during a test:
With it you can also do stuff like:
Worth taking a look.