我是测试新手,试图获取第二个流量值并断言它,当我逐个运行此测试时运行良好,但是当我运行整个测试时,第一个测试运行良好,其余测试给我超时错误。
错误 :
After waiting for 60000 ms, the test coroutine is not completing
kotlinx.coroutines.test.UncompletedCoroutinesError: After waiting for 60000 ms, the test coroutine is not completing
at app//kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTestCoroutine$3$3.invokeSuspend(TestBuilders.kt:304)
(Coroutine boundary)
Run Code Online (Sandbox Code Playgroud)
@OptIn(ExperimentalCoroutinesApi::class)
class HomeViewModelTest {
private lateinit var viewModel: HomeViewModel
private val testDispatcher = UnconfinedTestDispatcher()
@Before
fun setup() {
viewModel = HomeViewModel(FakeOrderRepository())
Dispatchers.setMain(testDispatcher)
}
@After
fun tearDown() {
Dispatchers.resetMain()
testDispatcher.cancel()
}
@Test
fun flowViewModelTesting1() = runTest {
val result = viewModel.homeUiState.drop(1).first()
assertThat(true).isTrue()
}
@Test
fun flowViewModelTesting2() = runTest {
val result …
Run Code Online (Sandbox Code Playgroud) 我正在尝试实现https://google.github.io/accompanist/navigation-material/并且我想将模型表扩展到自定义高度或超过半个屏幕,但我不知道如何实现它
当前型号BottomSheet
想要这样扩展