Flutter Integration测试在测试之间移动时失败



目前,在我的项目中,我正在添加多个集成测试,这些测试被分隔在不同的文件中。当尝试使用flutter test integration test运行所有测试时,在测试之间移动时会出现此错误

Error waiting for a debug connection: The log reader stopped unexpectedly, or never started.TestDeviceException(Unable to start the app on the device.)

这个错误在iOS或Android模拟器上运行时从未发生过,但由于这是一个桌面应用程序,我需要在Linux上进行测试,这就是错误发生的地方。

也许这可以帮助您:

sdk版本。在visualstudio安装程序中选择win11sdk(10.0.2220.00(windows 11需要选择win 11 sdk(10.0.2220.00(

https://github.com/flutter/flutter/issues/93635#issuecomment-969053206

我还没能用一个命令让我的桌面集成测试工作,但如果我把每个测试都写成自己的命令,它就会工作:

flutter test integration_test/features/fast_booking/fast_booking_test.dart --dart-define=FLAVOR=staging --dart-define=FLUTTER_TEST=true;flutter test integration_test/features/appointments/book_appointment_test.dart --dart-define=FLAVOR=staging --dart-define=FLUTTER_TEST=true

这不是最漂亮的解决方案,我希望Flutter团队发布一个官方解决方案。

相关问题

其中大多数都是特定于Windows的,但它们并不能解决MacOS上的问题。

  • https://github.com/flutter/flutter/issues/72985
  • https://github.com/flutter/flutter/issues/111076
  • https://github.com/flutter/flutter/issues/93635
  • https://github.com/flutter/flutter/issues/98890
  • https://github.com/flutter/flutter/issues/79723

最新更新