I'm writing some test code, my program uses both t...
# squarelibraries
a
I'm writing some test code, my program uses both the file system and SQL delight for a database. for all of the file i/o I inject a
FakeFileSystem
which makes the testing very easy to setup and cleanup. For the database, I can inject a sqlite driver and configure it for in memory. but the problem is these are end-to-end tests, so I have a fair bit of setup. and I'm struggling with how to easily populate these test databases. what I'd really like to do is just take a sqlite file, copy that into my fake file system. and then have a sqlite driver that accepts a file system object. but how do other people go about populating their database for tests?
j
Sqlite can't read or write to the fake FS, so you'd have to put it on the real file system
I would consider instead a single file with all your SQL queries that you load and then execute
It could live in assets in the test APK
a
ah okay, yeah that was the direction I was starting to head.
yeah right now cuz this is somewhat file system heavy, I have a bunch of resources in the test source set that get copied into the fake file system. so maybe I could set up a sequelite database the way I want and then export it to a SQL command file