lateinit var sqlDriver: SqlDriver lateinit var db: VisitAppDb private set override fun onBeforeTest() { sqlDriver = testSqlDriver() db = VisitAppDb(driver = sqlDriver) } override fun onAfterTest() { sqlDriver.close() } } class MyTest : HasTestRules { val dbTestRule = DbTestRule() override val testRules = TestRules(dbTestRule) @Test fun test() { dbTestRule.db.userQueries.insertOrReplace(User(userId = 1, name = "Foo")) val all = dbTestRule.db.userQueries.selectAll().executeAsList() assertEquals(1, all.size) } } !#FGPSF5FTU!"GUFS5FTUΛॻ͔ͳͯ͘Α͘ͳΔ