Database is a crucial part of any softwares nowadays, especially mobile applications. We use database to store various things, such as:
- app settings: to make it consistent between app launches.
- app context: to perserve the last screen user visited. (in case the app was killed, either intentionally by the user or automatically by the system to reclaim memory)
- data from a network reponse: to better support offline mode.
- anything you want to save for later submission when network is available.
- etc and etc…
Those are the things that make an app fast and responsive and eventually useful.
Therefore, we wanna make sure that our database works correctly. No mistakes or errors is tolerant here.
But how do we achieve that?
Well, you know, we write unit tests for it.