Android测试:UIAutomator与Espresso [英] Android Testing: UIAutomator vs Espresso

查看:484
本文介绍了Android测试:UIAutomator与Espresso的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找Android UI自动化的测试框架,偶然发现了UI AutomatorEspresso,这是我感到困惑的部分-

I was seeking for test frameworks for Android UI automation and I stumbled upon UI Automator and Espresso and this is the part I am confused about -

  1. 两者均由Google维护
  2. 两者均用于功能UI测试
  3. 两者都是Android唯一的框架
  1. Both are maintained by Google
  2. Both are used for functional UI testing
  3. Both are Android only frameworks

所以我的问题/疑问是-

So my questions/doubts here are -

  • UI AutomatorEspresso之间的主要区别是什么?
  • 是否需要修改源代码以集成任何这些框架?
  • 一个框架比另一个框架具有任何优势吗?如果是,那么哪个框架最适合Android应用程序的UI自动化?
  • What is the major difference between UI Automator and Espresso?
  • Will the source code have to be modified to integrate any of these frameworks?
  • Does one framework hold any advantage over the other? If yes, then which framework is the most suitable for UI automation of an Android app?

推荐答案

实际上,您不需要选择. UIAutomator和Espresso使用相同的工具运行器,因此您可以在单个测试中使用这两个命令. Espresso在UI上具有多种匹配器,断言和操作,而automator没有:

Actually, you don't need to choose. UIAutomator and Espresso use the same instrumentation runner, so you can use commands from both of them in a single test. Espresso has variety of matchers, assertions and actions on UI, that automator doesn't have:

浓缩咖啡速查表

Espresso在单独的线程中运行,与其他测试框架相比,它确实非常快.

Espresso is running in separate thread and it is really fast comparing to other test frameworks.

作为摘要:在测试中同时使用它们,Espresso是主要功能,UIAutomator是OS集成的附加工具.

as Summary: use both of them in your tests, Espresso is main and UIAutomator as an additional tool for OS integration.

这篇关于Android测试:UIAutomator与Espresso的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆