Testing Android App using greendao with Mockito -
i new android testing , trying write unit tests (running on local jvm) using mockito in android studio.
my ide setup (gradle scripts) done far.
dependencies { compile filetree(include: ['*.jar'], dir: 'libs') // unit testing dependencies. testcompile 'junit:junit:4.12' testcompile 'org.mockito:mockito-core:1.10.19' }
in app using greendao
orm have no abstraction of layer yet (planned future). when try test parts of application code using database related classes (like sqliteopenhelper
, sqlitedatabase
setting database, sqlitestatement
compiling statements, etc.) test exits exception, example sqliteopenhelper not mocked .
is @ possible write unit tests in scenario mocking database (without investing time abstract database layer)?
the problem right context
initializing database layer. using robolectric can use runtimeenvironment.application
context
object in test environment, initializing database layer unit tests running on local jvm without device or emulator.
Comments
Post a Comment