UIThreadTest
This class allows a test block to be run on the UI thread inside a custom context that is also created in the UI Thread.
While normally iOS tests already run on the UI thread, this prevents the Main dispatcher from working as long as that Thread is blocked, so this class is mostly used in conjunction with the com.splendo.kaluga.test.base.mainBackground entry point.
It is useful for Kotlin Native classes that only work when created on the UI thread, as it eases dealing with immutability and allows a shared context.
Inheritors
Properties
Link copied to clipboard
Creates the Test Context based on a CoroutineScope
Link copied to clipboard
open override val createTestContextWithConfiguration: suspend (configuration: Unit, scope: CoroutineScope) -> Context
Creates the TestContext based on Configuration and CoroutineScope
Functions
Link copied to clipboard
Link copied to clipboard
fun testOnUIThread(configuration: Unit, cancelScopeAfterTest: Boolean = false, block: suspend Context.() -> Unit)
Run your test block on the UI thread and inside the TestContext.