Testing in Android Part 1: Unit Tests

Using JUnit4 to write tests for business logic

Siva Ganesh Kantamani
Programming Geeks

--

Photo by UX Indonesia on Unsplash

Introduction

In this series of testing in Android, we’re going to learn everything we need to test android apps, starting from testing business logic to end-to-end feature testing.

We’ll start the series with the unit tests, which concentrate on testing the business logic, more about this in the following sections. The second part is about integration tests and finally, ends the series with end-to-end tests in the third part.

Why Do We Need Test cases?

For a long time, I had this question, but recently I get a chance to work on some huge projects where having test cases is very crucial. With proper test cases can not only verify the apps works as expected, but we can do this over and over again without any manual work.

For suppose, consider a multimodule application where different teams are working on each module. If someone changes the source code of a particular module, It’s hard to track and make sure the new changes are not affecting the existing functionality not only in that module but also throughout the project.

That’s when writing test cases payoff, we can verify existing features(and new features as well) throughout…

--

--