Learning Path: Android: Test-Driven Android App Development
4.2 (47 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
339 students enrolled

Learning Path: Android: Test-Driven Android App Development

See the first steps to building fast and dynamic Android apps employing test-driven development
4.2 (47 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
340 students enrolled
Created by Packt Publishing
Last updated 4/2017
English [Auto]
Current price: $129.99 Original price: $199.99 Discount: 35% off
1 day left at this price!
30-Day Money-Back Guarantee
This course includes
  • 10 hours on-demand video
  • 1 downloadable resource
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • Leverage well known, best practices for Android app development
  • Use the best third-party libraries in the business which are not known to developers at the beginner-intermediate level
  • Understand why test driven design is important
  • Write reusable test components with behavior driven design
  • Use plugins that enhance the testing experience
  • Learn Android-specific test frameworks, including UI tests
Course content
Expand all 70 lectures 09:51:28
+ Learning Android N Application Development
39 lectures 04:29:04

This video gives an overview of the entire course.

Preview 04:47

The aim of this video is to teach the main features of Android N.

Why Android N?

The aim of this video is to teach the basics of Android.

Basics of Android

The aim of this video is to explain the anatomy of our app

Anatomy of Our app

The aim of this video is to take a look at the various tools that help us in building android apps.

Tools Overview

The aim of this video is to have a look at Android Studio and emulators in a live environment

Tools – Android Studio and Emulators

With this video, we share an overview of the steps involved in creating the UI of the application.

Preview 03:34

The aim of this video is to get started with a simple "hello world" application.

Hello World

The aim of this video is to implement the home screen card of our application.

Home Page Card

The aim of this video is to create the home page card in the application and see it in the IDE preview

Home Page Card Implementation

The aim of this video is to explain a way to create an object that represents a news article and find a way to show multiple news articles on the screen

NewsArticle, Adapters, and RecyclerView

The aim of this video is to create a NewsArticle object that represents each news article

Creating a NewsArticle

The aim of this video is to implement an array adapter that will be responsible for drawing a list of news articles on the screen.

Implementing the ArrayAdapter

The aim of this video is to Implement the RecyclerView in the app.

Implementing the RecyclerView

Our aim is to understand and implement the details page in our app.

The Details Page

Our aim is to know more about event handling and navigation in our app.

Event Handling and Navigation

The aim of this video is to enable navigation to the Details Activity.

Enabling Navigation

The aim of this video is to understand and implement the multiwindow features in our app.

Android N Multiwindow Features

The aim of this video is to explain all the steps involved in creating the networking layer in the app.

Preview 03:28

The aim of this video is to teach the basic concepts associated with networking (or talking to servers on the Internet) in a typical mobile app like ours.

Networking Basics

The aim of this video is to learn about the News API that we will be using the app.

News API

The aim of this video is to understand the steps in making sense of the news API response.

Parsing the News API Response

The aim of this video is to parse the NewsAPI response with JSONSchemaToPOJO and GSON.

Parsing the News API Response – Implementation

The aim of this video is to understand how to best use a networking library and retrofit.


With this video, learn to Implement retrofit in the app.

Retrofit Implementation

The aim of this video is to test a network API call.

Testing API calls

In this video, learn how to connect the network response to the UI to show actual news in the app.

Preview 09:41

In this video, you will learn about measurement tools.

Analytics and More

In this video, we'll implement firebase analytics and crash reporting in the app.

Analytics and Crash Reporting Implementation

The aim of this video is to teach you how to add attribution in the app.

Addition Attribution

The aim of this video is to introduce the types of testing in Android and why it's useful.

Preview 07:09

In this video, understand and implement unit testing in our app.

Unit Testing in Android

In this video, we will implement unit testing powered by Powermock.

Unit Testing with Powermock

We now understand and implement instrumentation testing in android.

Instrumentation Testing in Android

The aim of this video is to implement espresso-based instrumentation tests in the app.

Espresso Implementation

The aim of this video is to help you prepare your app for it to be launched on the Play Store.

Preview 11:03

Launch an app on the Play Store.

Uploading to the Play Store

The aim of this video is to discuss some of the best practices in Android app development.

Preview 10:39

We look back at some of the things we've done in this course and some of the ways we can improve our app.

Review of the Project
+ Test-Driven Android
31 lectures 05:22:24

This video gives an overview of the entire course.

Preview 05:40

As a project falls behind, the items at the end of a development cycle are the ones most likely to get skipped. Thus, it’s important to write tests first.

Why Test-Driven Design?

GUI at the top, integration in the middle, and unit tests at the bottom. Unit tests are the most important, so they get the most space in our testing real estate.

The Testing Pyramid

Behavior-driven design is a way we can communicate universally across disciplines. This communication allows us to understand the requirements of the software we want to create.

Behavior-Driven Development

How unit testing specifically relates to Android, and how Android projects are structured for unit testing.

Android Project Structure

Discuss Java and Object Oriented Design best practices, why we use interfaces, how to create data transfer objects, UI, business logic, and DAO layers.

Preview 07:11

Many hobbyist programmers don’t understand why we should use interfaces. The first part of understanding interfaces is understanding polymorphism: the variable type tells us what methods we’re allowed to call, and the object type tells us what will happen when we call those methods. Interfaces decouple the variable from the object type and allow us to easily change the object type.

Why Interfaces?

When developing in layers, a Data Transfer Object (DTO) can be used to transfer data across layers. DTOs are simple Plain Old Java Objects (POJOs) that are generally a collection of attributes with getters and setters. In this video, we show how to create a DTO.

DTO Best Practices

More details on what each layer does, what belongs in the user interface, what belongs in the business logic, and what belongs in the data access layers. We’ll show with examples.

Layer Description – UI, Business Logic, and Data Access

If tests feel like a necessary evil. But they can make unit test coverage exponentially more difficult. Discuss how good object-oriented design minimizes the need for if tests, and how that makes testing easier.

Minimizing If Tests

Discuss fundamental JUnit frameworks: Fixtures, Test Suites, and Test Runners. Create a simple JUnit test with @Before and @Test annotations.

Preview 12:13

JUnit 4 takes advantage of many annotations to enhance our test and allow us to create tests as Plain Old Java Objects (POJOs). In this video, we explore several JUnit annotations.

JUnit Annotations

Demonstration of runtime JUnit annotations: @Before, @BeforeClass, @After, @AfterClass, and @Test.

Example with Setup and Teardown

Test-driven design creates a good design. We consider what is unnecessarily redundant in our program. The more we can do with less code, the less we have to test. In this section, we model our program, and refactor it using ArgoUML.

Design for Test

Test-driven design means that we write a test before writing the class we’re going to test. In this video, we create a test for a simple NetworkDAO, watch the test fail, and then build the NetworkDAO until the test passes.

Create a Test-driven Design Test

Describe a history of BDD. Discuss how BDD relates to specifications.

Preview 10:44

Using the requirements document from 4.1, we create our first given-when-then BDD and TDD unit test in this hands-on example. Discuss the prerequisites and syntax.

Example – Given, When, and Then

Expand on our BDD unit test by adding more examples from the requirements document, defined in video 4.1.

Extended Given, When, and Then Test

Become a JUnit expert by exploring more JUnit 4 asserts: assertEquals, assertNull, assertNotNull, assertTrue, assertFalse, and more.

More Asserts

See assertEquals and assertNotNull asserts in a hands-on example.

More Assert Examples

Hamcrest offers us a new assert framework where we can write tests in a flexible, readable, and natural language format. Hamcrest asserts are ideal for collections and String comparisons.

Hamcrest Asserts

Use Mockito to mock out dependencies. This removes excuses for why we can’t do unit tests.

Preview 19:11

Demonstrate Mockito with a hands-on example.

Mockito Example

When you take short-term shortcuts that create long-term problems, you’re creating technical debt. If left unaddressed, technical debt results in additional development work.

Technical Debt

Unit test code coverage is a quantitative measure of technical debt. Code coverage shows the percentage of code covered and the percentage not covered. The percentage not covered is technical debt.

Unit Test Code Coverage in Android Studio

One reason we neglect writing unit tests is that we simply forget to run them. If we make running compulsory, just as automatic builds are today, we will see results immediately and be motivated to write our unit tests.

Build environment

Instrumentation tests run using the JUnit framework and have access to Android framework classes as well, such as Context and Parcelable. Instrumentation tests are ideal for functional and UI testing.

Preview 10:06

Show how to write, execute, and debug an instrumentation test with a hands-on example.

Android Instrumentation Test Example

Espresso is a new framework that allows you to easily record instrumentation tests with a running Android emulator and a UI test recording widget. This allows the author to write and execute tests against complex components, like a ListView.

Espresso Overview

Show how to write an Espresso test with an example.

Example Espresso Test

The Android ecosystem is complex, and we must account for this complexity in our tests. We can use several tools, including Firebase, to assist us in this testing.

Firebase Test Lab
  • Requires basic knowledge of programming in Java.
  • Basic familiarity with the Android environment and ecosystem

Packt’s Video Learning Paths are a series of individual video products put together in a logical and stepwise manner such that each video builds on the skills learned in the video before i

Android Nougat is the 7th major version of the Android operating system. Test-driven development enables good design. It only makes sense to adopt it for Android N app development. Sounds interesting? Let’s see how easy it is!

Nougat introduces notable changes to the operating system and its development platform, including the ability to display multiple apps on-screen at once in a split-screen view, support for inline replies to notifications, an OpenJDK-based Java environment, support for the Vulkan graphics rendering API, and "seamless" system updates on supported devices. Good object-oriented design and test-driven design are complementary and this Learning Path will explain how.

This Learning Path covers the fundamentals of app development in Android N including the Android Studio and Android SDK, networking concepts with the API, Firebase analytics and crash analysis, and publishing your application on the Play Store. We will then look in detail how test-driven development can be implemented for building apps in Android.

The goal of this Learning Path is to help you build an application for Android Nougat, using the latest features of Android. We will focus on individual app modules and teach you to implement different TDD methods to create reliable and smarter apps in less time.

This Learning Path is authored by some of the best in their fields.

Soham Mondal

Soham Mondal has worked with Android for about 4 years now and his own app Skyro Voice Recorder has around half a million downloads on the Play Store and has been featured there a couple of times. Apart from that, he has consulted with a bunch of start-ups on Android/UX and was an organizer with Blrdroid, one of the largest Android groups in the world.

Brandan Jones

Brandan Jones has been an Adjunct Assistant Professor for the University of Cincinnati since the 2000-2001 school year. He has taught many courses in programming, from introductory programming to full stack development.

Brandan proposed and created the first Android programming course at the University of Cincinnati, and has been teaching it ever since. He reapplied this course and taught it at Northwestern University’s School of Continuing Studies as well.

Brandan is the creator of the Android app PlantPlaces Mobile, which allows users to search for plants by color, and GPS plants. He wrote this app in 2012, using TDD principles. He has used selected JSON feeds from that app in the examples in this video course. Brandan’s mix of both academic and professional experience means that he brings real-world concepts to the classroom. Most of his high level classes include hands on experience with unit testing, scrum, and distributed version control systems.

Who this course is for:
  • If you know Java in depth and have built applications with the language but not apps for Android devices, then this Learning Path is for you. Android developers wanting to learn and leverage test-driven development in their app development will also find this Learning Path useful.