java Appium 与 Espresso 的自动化测试框架
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35584577/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Appium vs Espresso for automated testing framework
提问by python
For last few weeks, I was using Appium(python)
for android testing but yesterday we have decided to shift to Expresso(Java)
for automated testing. There are couple of reasons why we are making this shift:
过去几周,我一直在Appium(python)
用于 android 测试,但昨天我们决定转向Expresso(Java)
自动化测试。我们进行这种转变的原因有两个:
We want to scale out our automated testing, and there are lot of features not present in appium.
This is one of the latest testing framework for android, and has nice backward compatibility.
- Small API and very easy to customize.
我们想要扩展我们的自动化测试,并且 appium 中没有很多功能。
这是最新的android测试框架之一,具有很好的向后兼容性。
- 小型 API,非常容易定制。
I have been reading for Espressobut I don't find anything great at all, If I compare it with Appium. I am a Python/R developer
so maybe there are couple of points I am not able to understand. Would anyone like to help me understand if the shift to this new testing framework will be good for future? I am missing the bigger picture here, and any help would be greatly appreciated.
我一直在阅读Espresso,但如果将它与 Appium 进行比较,我根本找不到任何好的东西。我是一个Python/R developer
所以也许有几点我无法理解。有没有人愿意帮助我了解转向这个新的测试框架是否对未来有好处?我在这里错过了更大的图景,任何帮助将不胜感激。
采纳答案by anuja jain
- The Shifting will be very much useful as Espresso supports testing activities outside the app like camera, browser and dialer etc which appium does not support.
- Espresso you can test toast message, auto complete and dialogs which are outside app.
- With Espresso Test Suit you can find code coverage and measure your testing efforts.
- Shifting 将非常有用,因为 Espresso 支持应用程序之外的测试活动,例如 appium 不支持的相机、浏览器和拨号器等。
- Espresso 您可以测试 Toast 消息、自动完成和应用程序之外的对话框。
- 使用 Espresso Test Suit,您可以找到代码覆盖率并衡量您的测试工作。
回答by karthick23
You can go to Espresso if you're sticking only to Android automation and have no idea of automating iOS.
如果您只坚持使用 Android 自动化并且不知道自动化 iOS,则可以使用 Espresso。
AFIKW, Espresso needs source code of the app in order to automate it.
AFIKW,Espresso 需要应用程序的源代码才能使其自动化。
Advantage is, it's directly open-sourced by google.
优点是,它是由谷歌直接开源的。
But my go is to go with Appium since its a large open sourced community with huge enhancements on its way and easy to automate with any programming language and needless to say it supports both Android and iOS.
但我会选择 Appium,因为它是一个大型开源社区,在其方式上有很大的改进,并且易于使用任何编程语言实现自动化,不用说它同时支持 Android 和 iOS。
回答by kiedysktos
I agree that Espresso may be be very efficient when it comes to Android testing solely. For example, it can run only the activity it's testing, which is great.
我同意 Espresso 仅在 Android 测试方面可能非常有效。例如,它只能运行它正在测试的活动,这很好。
Still, I stick to the Appium because it has the same API for both AndroidDriver and iOSDriver. Usually Android apps are accompanied by iOS apps, and if you're responsible for the UI automation, you have to take overall costs into account.
尽管如此,我还是坚持使用 Appium,因为它对 AndroidDriver 和 iOSDriver 具有相同的 API。通常 Android 应用程序都伴随着 iOS 应用程序,如果您负责 UI 自动化,则必须考虑整体成本。
Appium has following advantages over platform-specific solution:
Appium 相对于特定平台的解决方案具有以下优势:
- Android and iOS tests can share many classes, including helper methods and configuration,
- Android and iOS tests can share common tests logic on higher level, while having different or slightly different implementation on lower level (for example sometimes I can just copy whole page object class and make simple change of locators in order to make it work on the other platform),
- same API enables us to seamlessly switch between the iOS and Android test development in a team. Easy switching to Selenium for Web development is additional benefit.
- Android 和 iOS 测试可以共享许多类,包括辅助方法和配置,
- Android 和 iOS 测试可以在较高级别共享通用测试逻辑,而在较低级别具有不同或略有不同的实现(例如,有时我可以复制整个页面对象类并进行简单的定位器更改以使其在另一个上工作平台),
- 相同的 API 使我们能够在团队中在 iOS 和 Android 测试开发之间无缝切换。轻松切换到 Selenium 进行 Web 开发是额外的好处。
The biggest disadvantage of Appium is the speed of longer test scenarios and some difficulties in locating elements, but still it's my choice.
Appium 最大的缺点是测试场景较长的速度和定位元素的一些困难,但它仍然是我的选择。
As the side note, I'd like to add that you shouldn't forget about the test pyramid which refers to test automation. Please keep balance between Unit Tests, Integration tests and UI tests http://martinfowler.com/bliki/TestPyramid.html
作为旁注,我想补充一点,您不应忘记涉及测试自动化的测试金字塔。请在单元测试、集成测试和 UI 测试之间保持平衡http://martinfowler.com/bliki/TestPyramid.html
回答by Santhosh Kumar
The main difference between the two is,
两者的主要区别在于,
Espresso test is within the application and it is aware of all the layers of the application. So you can mock certain layers of app, more like a white-box testing
Espresso 测试在应用程序中,它了解应用程序的所有层。所以你可以模拟应用程序的某些层,更像是白盒测试
Appium tests are black-box, tests know only the UI layer of the app. Main advantage is for cross-platform testing.
Appium 测试是黑盒测试,测试只知道应用程序的 UI 层。主要优点是跨平台测试。