Testing activities and applications

Here, we cover some common cases that you will find in your day-to-day testing, including dealing with Intents, Preferences, and Context. You can adapt these patterns to suit your specific needs.

Mocking applications and preferences

In Android parlance, an application refers to a base class used when it is needed to maintain a global application state. The full package is android.app.Application. This can be utilized when dealing with shared preferences.

We expect that the tests that alter these preferences' values will not affect the behavior of the real application. Without the correct testing framework, the tests could delete user account information for an application that stores these values as shared preferences. ...

Get Learning Android Application Testing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.