Add Unit Tests
We’re starting at the base testing level, a JUnit unit test. If you’re unfamiliar, unit testing is where we validate that a single piece of our code is working. This is a general software development concept rather than an Android concept and is used with all kinds of applications.
JUnit is the testing framework used for most Android unit testing, and the dependency is already in your application. It’s used so often when building an app that the default Android template includes it. JUnit gives us a number of annotations and functions to use when testing to help write tests and make them more readable.
In particular, we’re going to be using the @Test, @Before, and @BeforeClass annotations in our tests. The @Test annotation marks ...
Get Kotlin and Android Development featuring Jetpack now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.