Skip to Content
Native Mobile Development
book

Native Mobile Development

by Shaun Lewis, Mike Dunn
November 2019
Intermediate to advanced
394 pages
9h 44m
English
O'Reilly Media, Inc.
Content preview from Native Mobile Development

Chapter 14. Testing

Developers write code. Often they write a lot of code. The web of dependencies between objects and other services is often complex and not easily discernible; objects depend on other objects to work property. Making a change in even relatively simple codebases in one place can cause a bug or a crash in another part of the codebase. The house of cards that is your app can come quickly crashing down.

Where does testing fit into all this? Testing is a way to provide developers with a level of confidence that the changes being made are not unknowingly affecting other parts of the application. Ideally, these tests would be automated and deterministic so as not to be subject to the unpredictable whims of humanity, in which error and poor judgment often present themselves. Fortunately, most modern platforms have testing built in. Both Android and iOS have full-featured and incredibly powerful testing tools that can be used to assist in developing code. Let’s see how these tools work.

Tasks

In this chapter, you’ll learn to:

  1. Set up and run unit tests.

  2. Set up and run integration tests.

Android

AOSP defines and differentiates a few different types of tests:

Unit tests

These are highly focused tests that run on a single class, usually a single method in that class. If a unit test fails, you should know exactly where in your code the issue is. They have low fidelity since in the real world, your app involves much more than the execution of one method or class. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Pro iPhone Development with SwiftUI: Design and Manage Top Quality Apps

Pro iPhone Development with SwiftUI: Design and Manage Top Quality Apps

Wallace Wang
Ionic in Action

Ionic in Action

Jeremy Wilken
What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz

Publisher Resources

ISBN: 9781492052869Errata PageSupplemental Content