【发布时间】:2022-10-25 18:52:47
【问题描述】:
我正在尝试使用 Robolectric 测试作曲。我创建了一个示例测试:
@RunWith(RobolectricTestRunner::class)
class ProductDescriptionComposeTest {
@get:Rule
val composeTestRule = createComposeRule()
@Test
fun testShowMoreText() {
}
}
并添加到build.gradle:
testImplementation 'junit:junit:4.13.2'
testImplementation "org.robolectric:robolectric:4.8.1"
testImplementation 'androidx.test:core:1.4.0'
testImplementation 'androidx.compose.ui:ui-test-junit4:1.2.1'
debugImplementation 'androidx.compose.ui:ui-test-manifest:1.2.1'
当我运行它时,我得到:
java.lang.AbstractMethodError: Receiver class androidx.compose.ui.test.TestMonotonicFrameClock does not define or inherit an implementation of the resolved method 'abstract kotlin.coroutines.CoroutineContext$Key getKey()' of interface kotlin.coroutines.CoroutineContext$Element.
at kotlin.coroutines.CoroutineContext$plus$1.invoke(CoroutineContext.kt:33)
at kotlin.coroutines.CoroutineContext$plus$1.invoke(CoroutineContext.kt:32)
在线:
val composeTestRule = createComposeRule()
我试图搜索,但所有示例代码都包含相同的并且可以工作
【问题讨论】:
标签: android android-jetpack-compose robolectric