Book Image

Test-Driven Android [Video]

By : Brandan Jones
Book Image

Test-Driven Android [Video]

By: Brandan Jones

Overview of this book

<p>In Test Driven Android Development, we discuss how good Object Oriented Design and Test Driven Design are complementary. We create a simple JUnit test, using a stub object that represents a data feed. Next, we demonstrate how to write a test driven design unit test for a Java class that performs network operations. After that, we create a unit test for a data access object that uses a JSON data feed. Our test includes JUnit 4 asserts and Hamcrest-style asserst. Then, we discuss blockers that prevent us from writing unit tests, and how we can use Mockito, code coverage, and automatic test execution to ameliorate those blockers. Finally, we look at UI testing with Espresso, and multi-platform testing with Firebase.</p> <h1>Style and Approach</h1> <p>This is a step by step video with a tutorial style approach. The sections will focus on individual app modules and how implementing different TDD method will help you to create reliable and smarter apps in less time.</p>
Table of Contents (6 chapters)
Chapter 2
Design for Test
Content Locked
Section 2
Why Interfaces?
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. - Create a new package to hold a DTO class. - Create a simple interface with one method. Show how the DTO can be used in the method signature. - Create and describe JavaDoc on an interface.