Bog'liq Bailey J., Dominguez A., Djermanovic D. - Saving Data on Android (1st Edition) - 2019
Robolectric to
see how to unit test the
model portion of the program.
Unit Tes/ng with Robolectric You're able to view the contents of the database using the command line or a third-
party tool. Wouldn't it also be nice to run a JUnit test on the model portion of the
app? This can often be overlooked in the development and testing process.
To create some simple unit tests, you will use a framework called
Robolectric .
Simply put, Robolectric is a framework that allows you to write Android-powered
unit tests and run them on a desktop JVM while still using the Android API.
Robolectric enables you to run your Android tests in your integration environment
without any additional setup, which makes it a convenient choice.
Saving Data on Android Chapter 3: SQLite Database raywenderlich.com 64
Now, you will create a unit test to test the
insert functionality of the database to
determine if the names of the TODO items are inserting into the database correctly.
To get started, open