lundi 25 juillet 2016

Android app testing - How to test DAO layer with real database?

I'm trying to write unit tests for our app and I'm a little bit confused about testing our DAO layer. This layer uses a lot of methods of real SQLiteDatabase and we don't think that using Mockito in this case is a proper way. So, our question is - how to test DAO layer with real database? Is it real in Android to get real instance of database inside unit tests?

What we want to test:

  1. execution of SQL statements, for example database.execSQL(..) methods.
  2. execution of insert, update, delete, rawQuery methods of SQLiteDatabase class.

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire