lundi 1 août 2016

How to test IntentService android?

How can I test an IntentService in android without using the deprecated ServiceTestCase?

From the documentation of the ServiceTestCase:

This class was deprecated in API level 24. Use ServiceTestRule instead. New tests should be written using the Android Testing Support Library.

But the ServiceTestRule documentation says it doesn't support IntentServices:

Note: This rule doesn't support IntentService because it's automatically destroyed when onHandleIntent(android.content.Intent) finishes all outstanding commands. So there is no guarantee to establish a successful connection in a timely manner.

How am I supposed to test an IntentService then ?

Aucun commentaire:

Enregistrer un commentaire