Book Image

Learning Android Application Testing

Book Image

Learning Android Application Testing

Overview of this book

Table of Contents (16 chapters)
Learning Android Application Testing
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a Java module


On top of this template project, we want to add another module of code. This will be a Java-only module and will act as a dependency or library, if you will, for our main Android module.

The idea here is two-fold. First, it allows you to separate code that is Java only, and does not have a dependency on Android, in a big project this can be your core domain; the business logic that runs your app, and it is important that you modularize this, so you can work on it without having to think about Android as well.

Secondly, having a Java-only module as we've said before, allows you to call on the vast history of Java as an established programming language when it comes to testing. Testing of the Java module is fast, simple, and easy. You can write JUnit tests for the JVM and have them running in milliseconds (which we will do!).

From Android Studio, navigate to File | New Module, this gives you the Create new module dialog. Under More Modules, select Java Library, and hit...