Testing Your Changes

We saw the basics of testing in Android back in a previous chapter. However, that was just with some pre-defined tests created by Android Studio’s new-project wizard.

Presumably, your app will have more code that needs testing.

(if your app is purely the result of the new-project wizard templates, feel free to skip this chapter)

In this chapter, we will explore a bit more about how to write and run tests in Android, so that you can test your app code.

A Quick Recap

There are two broad categories of tests in Android: instrumented tests and unit tests.

Instrumented tests:

Unit tests:

Both categories of tests will look the same on the surface, in that both use JUnit4 and have similar structures (e.g., @Test-annotated methods or functions).


Prev Table of Contents Next

This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.