Android Testing Guide
Minimum price
Suggested price

Android Testing Guide

Practical tips and techniques for testing real-world Android applications

About the Book

Have you gotten your hands dirty with Android application development, but lack a reliable test coverage? Does your application testing procedure consist of just a series of manual view clicks? Do you spend hours testing your entire app everytime you want to make a release? Or do you just cross your fingers and hope for the best that everything will just work?

Don't worry, everyone has been there at some point. The only problem is that testing can be a tricky thing (especially in the Android world). In fact, it's quite possible that your codebase, as it currently stands, is untestable! What you may not realize is that, while, yes, testing does help to ensure that your code works as expected, following this pattern will also make you a better developer. That messy, untestable spaghetti code that you might have snuck into your project in the past will never happen again. Trust me, as soon as you bring the phrase "how could I test this?" to the forefront of every new piece of code you write, you'll, with a smile on your face, look back to your former self, and laugh at your crazy, cowboy ways. Welcome to modern software development world.

I'll show you how I got past that hurdle, started writing robust and more maintainable code, increasing my code's trustworthiness and saving countless hours of debugging unforeseen bugs.

As the book progresses towards completion, the price may gradually increase. By buying early you not only provide motivation, but you also get a good deal because you get all updates for free. The target date for next version is end of November.

  • Share this book

  • Categories

    • Android
    • Java
    • Testing
  • Installments completed

    1 / 3

About the Author

Ravindra Kumar
Ravindra Kumar

Ravindra Kumar is an Android Engineer,A Computer Polyglot from Bengaluru, India. Android + WEB ♥'r, speaker, startup geek, open source junkie.

He has a strong interest in code quality, testing and automation - preferably all three together. Combining technical with soft skills, he also ventures into the realms of mentoring and article writing, He hates doing things manually, and hates to see src/test/java directories with Empty Example classes.

He believes that by working with legacy code, and improving it, he can make the world a better place. To his disappointment, the world does not seem to care all that much about his efforts.

He started as a Web Engineer who used to write lots of javascript, but after some time, looking for his real passion, he started his journey in mobile app development though Titanium, later he discovered the Android world. After getting some experience on such an awesome platform, he started a new adventure at a mobile company, where he led several projects for important Indian companies.

He is a pretty normal person – a husband, father of one loves cricket.

Follow @ravidsrk on Twitter or email him at

Table of Contents

  • About the Author
  • About the Reviewers
  • Welcome
    • Exercises
    • Errata
    • How to Consume This Book
    • Get in Touch
    • Is this book for you?
  • Intro
  • 1 Test Everything
    • 1.1 You already know testing
    • 1.2 Takeaways from TDD
    • 1.3 What Should I Test?
    • 1.4 Signs of Untestable Code
    • 2.2 Beyond JUnit basics
    • 2.3 Rules
    • 2.4 Assertions
    • 2.5 Hamcrest
  • 3 Easier Testing With Mockito
    • 3.1 Why Mockito?
    • 3.2 Test Doubles
    • 3.3 Verify
    • 3.4 ArgumentCaptor
  • 4 Testing on Android
    • 4.1 Local Tests
    • 4.2 Instrumented tests
    • 4.3 Android test rules
    • 4.4 Rule to test Android Activity
    • 4.5 Rule to test Android Service
    • 4.6 Rule to test Android Intents
    • 4.7 Android instrumented tests
    • 4.8 Test filtering
  • 5 Espresso
    • 5.1 Basics
    • 5.2 Testing RecyclerView
    • 5.3 Testing Toast
    • 5.4 Testing Intents
    • 5.5 Testing Synchronisation with background jobs
    • 5.6 Espresso utils
  • 6 Robolectric
    • 6.1 Testing Activities
    • 6.2 Testing Fragments
    • 6.3 Testing Sqlite
    • 6.4 Testing Job Scheduler
  • 7 REST API Testing on Android.
    • 7.1 MockWebServer
    • 7.2 RESTMock
    • 7.3 WireMock
  • 8 Testing Android Persistance
    • 8.1 Testing Sqlite
    • 8.2 Testing Realm
    • 8.3 Testing Room
  • 9 Practical Android Testing
    • 9.1 Introduction to MVP, MVVM
    • 9.2 Testing Presenters
    • 9.3 Testing RxJava
  • 10 Kotlin Android Testing
    • 10.1 Issues
    • 10.2 Spek
    • 10.3 Mockito Kotlin
  • 11 Code Quality
    • 11.1 Checkstyle
    • 11.2 PMD
    • 11.3 Findbugs
    • 11.4 Code coverage with Jococo
  • 12 Continuous Integration
    • 12.1 Travis CI
    • 12.2 Circle CI
    • 12.3 BuddyBuild
    • 12.4 Bitrise
  • 13 Extra concepts
    • 13.1 Asserting with assertThat
    • 13.2 Assertj
    • 13.3 EasyMock
    • 13.4 PowerMock
    • 13.5 MonkeyRunner
    • 13.6 Robotium
    • 13.7 UI testing and UI Automator
  • 14 Misc
    • 14.1 Bad tests to Good tests
    • 14.2 Behavior-driven development
    • 14.3 Contributing to open-source
  • References

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub