mercredi 1 mars 2017

Is it possible to get an activity result from an instrumentation test?

I have an activity(A) in my app, which is started by an other activity(B) with startActivityForResult(). When a button is clicked in A, it will call setResult() and finish(), and go back to B.

How can I get that result from A, in my instrumentation tests?

I would like to keep it simple, and directly start A from my test, and not go trough B(and the activities before that).

I'm using robotium, and I've look into other tools too, and have not found anything useful.

getActivityMonitor().getResult() is null. Robotium does not start the activity with startActivityForResult() anyway. I don't want to mock the result from activity A, I want to check it's validity.

My current workaround is to read the value out of the activity with reflection, but there must be a better way.

Aucun commentaire:

Enregistrer un commentaire