本文介绍了使用espresso运行的UIAutomator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在测试应设置为默认启动器的应用程序.

I am currently testing an application that should be set as the default launcher.

我已经运行了一组Espresso测试,但是只有在用户先前选择了我的应用作为启动器时,它们才起作用.

I already have a set of Espresso tests running, but they only work if the user has previously selected my app as the launcher.

Espresso无法访问用户出现的对话框,以便他可以选择启动器,因为该对话框位于应用程序本身之外.但是,UIAutomator完全可以与之交互.

The dialog that appears to the user so that he can select the launcher is not reachable by Espresso, since it is outside the app itself. However, UIAutomator would be perfectly able to interact with it.

因此,我想知道在Espresso测试之前是否可以使用某种UIAutomator脚本.

Hence, I would like to know if it is possible to use some kind of UIAutomator script before the Espresso tests.

推荐答案

由于UIAutomator 2.0现在基于Android Instrumentation,因此您可以在一个测试套件中运行EspressoUIAutomator测试.您可以使用测试方法命名来先运行UIAutomator测试,然后再运行其他Espresso东西.有关 UIAutomator 2.0 的更多信息,以及如何将其与Espresso一起使用此处.

Since UIAutomator 2.0 is now based on Android Instrumentation, you can run Espresso and UIAutomator tests in one test suite, for example. You can play with test methods naming to run UIAutomator tests first and then run other Espresso stuff. More about UIAutomator 2.0 and how to use it together with Espresso here.

这篇关于使用espresso运行的UIAutomator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 05:43