mardi 1 décembre 2015

Writing tests for an Activity in Android

I'm trying to write some tests for an Android Activity and I have a couple questions.

1) How can I obtain an instance of the Activity I'm testing.

I tried getActivity but I have a java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.Instrumentation.setInTouchMode(boolean)' on a null object reference

2)How can I test that an Activity B is called when the button is pressed?

3) How can I test Toast messages(if the pope up message equals "message") ?

Also any good sides or tips for writing test(what should be tested) for an Android activity are welcome.

Aucun commentaire:

Enregistrer un commentaire