gpt4 book ai didi

android - 由于 Android Camera Intent 重新绘制屏幕,​​Espresso 测试失败

转载 作者:太空狗 更新时间:2023-10-29 13:56:27 26 4
gpt4 key购买 nike

我有一个有摄像头的 Activity ,并且在摄像头上有一个 mask ,这是通过 onDraw() 方法完成的,我正在为摄像头屏幕上方的抽屉导航编写测试用例, 但出现错误

Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was 1472804618974 and now the last time the queue went idle was: 1472804618974. If these numbers are the same your activity might be hogging the event queue

如前所述,我已经关闭了动画 https://google.github.io/android-testing-support-library/docs/espresso/setup/index.html

不知道需要做什么。

最佳答案

I have already turned off the animation as already mentioned over https://google.github.io/android-testing-support-library/docs/espresso/setup/index.html

出现这个问题不是因为动画的转动,而是因为Espresso 框架特性:Espresso 取决于您实际的应用程序上下文。

Espresso for Android is perfect and fast test automation framework, but it has one important limitation - you are allowed to operate only inside your app under test context.

That means that it is not possible to automate tests for such app features like:

  • application push notifications
  • contact synchronization
  • navigating from another app to your app under test,

since you have to deal with other apps from the mobile device - Notification Bar, Contacts or People app, etc.

From: http://qathread.blogspot.com/2015/05/espresso-uiautomator-perfect-tandem.html

这意味着 Espresso 测试基于 UI 线程并在主线程空闲时等待()。

Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was 1472804618974 and now the last time the queue went idle was: 1472804618974. If these numbers are the same your activity might be hogging the event queue.

这意味着您的主线程实际上很忙,Espresso 无法执行任何新操作,它正在等待空闲的空闲资源运行。

要解决这个问题,您有以下选择:

我已经在使用 EspressoRobotiumUiAutomator,所以不要害怕混合使用它们。

希望对你有帮助

关于android - 由于 Android Camera Intent 重新绘制屏幕,​​Espresso 测试失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39287810/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com