Android: Testing an Intent Service

Note: The ServiceTestRule class does not support testing of IntentService objects. If you need to test a IntentService object, you should encapsulate the logic in a separate class and create a corresponding unit test instead.

There’s a handy thing in Espresso called the ServiceTestRule, which is for testing Services. Yay. I thought it was just what I needed until I read this bit of the documentation… OK, first up – refactoring my IntentService. This class already did very little, poking something else depending on the kind of Intent it received, and […]

Read More