New to android, what's the preferred way of tesing...
# android
m
New to android, what's the preferred way of tesing my UI and database correctly interact? I have tests for my Dao, and I have tests for my UI, but I'm unsure how to test that my UI correctly works with my Dao. E.g. clicking the save button correctly saves something to the database.
stackoverflow 1
j
We write mocked database code to test how the app handles the responses based on the response code. If we get a 200 then app does x if we get a 404 app does x so on and so forth. Then we write tests covering every scenario with mocked data to see how the application handles them all. Our database side writes the tests for the database itself. Aside from that we do a manual test for saves and deletions
m
With the first thing you mention, is that still using say espresso to test the UI, and then mocking the database out? How exactly do you mock the database out? I'm guessing using some kind of dependency injectrion?
j
We use Mockito and Esspresso.
m
How do you mock the db without any depending injection? What does your activity look like?
d
>>
Using Kotlin to build Android applications. Android Studio Integration. Android-specific Gradle. If not related to Kotlin, please consider using StackOverflow and/or http://android-united.community/.