Replies: 1 comment
-
Which tests did you have in mind? IIRC there aren't really tests that test "the database", most of the testing is of higher level components that possibly need a database to operate. And when they do an in-memory database is used as a fake (https://github.com/pachli/pachli-android/blob/main/core/database/src/test/kotlin/app/pachli/core/database/di/FakeDatabaseModule.kt). Not all of them do this, but mostly because I'm still in the process of converting tests over to using dependency injection so as much of the real code is in the test path as possible (ideally there would be no mocked objects anywhere in testing, either the real thing, or injected fakes like the in-memory database). I do want to expand the instrumented tests, as part of adding screenshot testing to the app, but that's a bit lower on the priority list at the moment. |
Beta Was this translation helpful? Give feedback.
-
Currently, the Room test uses unit test instead of InstrumentTest.
However, according to the official documentation1, InstrumentTest seems to be common way to test DB.
Therefore, I think that maybe we should adopt InstrumentTest for DB testing.
What do you think about it?
I created a discussion instead of an issue because it is possible that you are using UNIT TEST for some reason.
In that case, it should not be modified.
Footnotes
https://developer.android.com/training/data-storage/room/testing-db ↩
Beta Was this translation helpful? Give feedback.
All reactions