The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.


Testing with JUnit4

Presumably, you will want to test your code, beyond just playing around with it yourself by hand. Android offers several means of testing your app, covered in this next series of chapters.

The first Android SDK testing solution we will examine is the JUnit test framework. This is a standard Java unit testing framework. Originally, Android itself “baked in” a copy of JUnit3. This has since been deprecated, and modern Android testing is done with a separate copy of JUnit4, in the form of a AndroidJUnitRunner class.

In this chapter, we will review how to apply the AndroidJUnitRunner to run JUnit4 tests for our Android apps.

Prerequisites

Understanding this chapter requires that you have read the core chapters of the book.

This chapter also assumes you have some familiarity with JUnit, though you certainly do not need to be an expert. You can learn more about JUnit at the JUnit site.

Instrumentation Tests and Unit Tests

The preview of this section was abducted by space aliens.

Writing JUnit4 Test Cases

The preview of this section was whisked away by a shark-infested tornado.

Configuring Gradle

The preview of this section was accidentally identified as an Android 'tasty treat' by the Cookie Monster.

Running Your Instrumentation Tests

The preview of this section left for Hollywood to appear in a reality TV show.

Testing Android Library Projects

The preview of this section was eaten by a grue.

Testing and Runtime Permissions

The preview of this section is in an invisible, microscopic font.

The Android Test Orchestrator

The preview of this section is out seeking fame and fortune as the Dread Pirate Roberts.