• Online, Self-Paced
Course Description

Defensive Programming in Android uses coding practices and techniques to create apps that are reliable, resilient, and easily testable. This course will teach you about thinking defensively in your approach to errors and exception handling, and also how to create automated tests for Android apps.

Learning Objectives

Errors and Exceptions

  • start the course
  • recognize how errors and exceptions can be used in defensive programming
  • use the Java exception classes
  • use exception stack traces
  • test for specific kinds of errors based on domain and code
  • create custom Java error classes
  • inform end users of error information in an Android app
  • use an underlying error object to find out more detail about an error that has occurred
  • release Java resources in the event of an exception

Automated Unit Testing

  • recognize how unit testing can be used in defensive programming
  • use the android testing API to construct automated unit tests
  • use instrumentation in automated Android unit testing
  • use test case classes in Android automated unit testing
  • use Android assertion classes
  • use mock object classes in Android automated unit testing
  • use test runner classes for Android automated unit testing
  • view test results in the IDE

Automated UI Testing

  • recognize where end-to-end testing can be used in defensive programming
  • set up the Android Testing Support API for automated UI testing
  • use Espresso test classes for Android automated UI testing
  • use instrumentation of activities for Android automated UI testing
  • test UI components in Android
  • use ViewAction, ViewInteraction, and DataInteraction classes to simulate actions when testing an Android app

Assertions and Annotations

  • describe the use of assertions for defensive programming in Java for Android
  • use basic assert statements in Java for Android
  • identify and use precondition, postcondition and invariant assertions
  • use annotations to aid in programming defensively for Android

Practice: Exceptions and Assertions

  • create a Java app to use exceptions and assertions

Framework Connections