mardi 9 février 2016

Destroy and restart Activity with Testing Support Library

Using the old JUnit3-style tests in Android, I could do the following to destory and restart an activity:

Instrumentation inst = getInstrumentation();
Activity activity = inst.getActivity();
// do something
activity.finish();
activity = inst.getActivity();
// assert that activity's state is restored

How can I accomplish the same thing using the new Testing Support Library? I'm fine with using either Espresso and/or UI Automator or any other mechanism provided by the new library.

Aucun commentaire:

Enregistrer un commentaire