App Testing

Testing Android apps sometimes feels like it is more complicated than writing
the apps themselves. There seems to be a dizzying array of testing tools
and frameworks, and it may not be clear to you how these work together and which
ones to choose for different circumstances.

During this one-day seminar, we will explore the following:

JUnit4 for Instrumentation Testing

What is “instrumentation testing”? Does it involve trumpets or something?

How do we set up a basic JUnit4 test suite?

How do we run tests within Android Studio?

How do we run tests using Gradle tasks?

How do we test things that need a Context, like disk or database I/O?

How do we enable code coverage, and how do we get coverage reports?

Can we use other JUnit4-compatible libraries with our Android testing?

Espresso for GUI Testing

What is Espresso?

What are Hamcrest matchers?

How do we set up our project to use Espresso?

How do we find widgets in our UI to test?

How do we perform actions on those widgets, such as clicking buttons?

How do we validate that the widgets did what we wanted?

How do we test lists, such as ListView or RecyclerView?

Isn’t there a tool or something that simplifies all this?

What happens if we are testing something that should start an activity?

How do we test activity lifecycle behavior?

How can all of this work, given that we are doing I/O in the background?

UiAutomator for GUI Integration Testing

What is “GUI integration testing”?

What are scenarios for GUI integration testing?

What is UiAutomator?

How do we set up our project to use UiAutomator?

What is uiautomatorviewer?

How do we write UiAutomator-based instrumentation tests?

Can we blend UiAutomator with Espresso, or will the barista get confused?

Unit Testing

Haven’t we already been doing unit testing in the earlier parts of this seminar?

How do we set up plain Java modules in an Android project, and how do we unit test them?

How do we write unit tests for an Android module, for pure-Java code to test?

How do we use Mockito to create mocks and stubs?

How do we use Robolectric to unit test things that depend upon Android?

Other Testing Topics

What is the Test Monkey?

What are popular open source test frameworks, besides those already mentioned?

How do we run tests on multiple devices at once?

What are “test farms”, and do they involve corn?

What are legacy testing technologies that you may hear of but probably should not use?