iOS自动化测试-XCTest与Appium [英] iOS Automated Tests - XCTest vs Appium

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

问题描述

我正在寻求测试工程师和iOS开发人员对特定问题的意见.

I am looking for opinions from test engineers and iOS developers regarding a specific matter.

我已经使用Appium一年多了,在真实设备上运行移动Web测试时遇到了种种困难.每次Apple在XCTest或Safari中进行更改时,Appium都会受到直接影响(即使它们解决了某些问题,其他问题也会出现在它的位置),并且到现在为止,我花了更多时间解决与Appium相关的问题,因为而不是来自AUT的那些.

I have been using Appium for over a year now, and I have come across various difficulties while running mobile web tests on real devices. Every time Apple makes changes in XCTest or Safari, Appium is directly impacted (even if they fix something, some other issue pops up in its place), and it has come to a point where I'm spending more time resolving Appium related issues as opposed to the ones from an AUT.

此外,无论如何,您都需要一台Apple计算机来开发和执行Appium iOS测试.所以我想为什么不直接使用XCTest来使用Swift或XCTest支持的任何语言编写测试?

Furthermore, you would need an Apple computer to develop and execute Appium iOS tests anyway. So I thought why not use XCTest directly to write tests using Swift or whatever language that XCTest supports?

我非常感谢那些同时具有Appium和XCTest(Swift等)自动化测试经验的人的评论和意见.

I would very much appreciate comments and opinions from people who have experience with both Appium and XCTest (Swift, etc) automated tests.

与XCTest相比,使用Appium自动化iOS本机和Web应用程序测试有什么优势?

What are the advantages of using Appium to automate iOS native and web apps tests over XCTest?

推荐答案

正如您已经发现的,Appium的最大缺点之一是它是第三方框架,并且每次Apple发行Xcode版本时都会破坏很多.由于苹果现在维护自己的UI测试框架,因此这种情况不太可能改变.

As you've already discovered, one of the greatest disadvantages of Appium is that it's a third party framework and it breaks pretty much every time Apple makes an Xcode release. This is unlikely to change since Apple now maintains its own UI testing framework.

使用Appium还有其他优势-您可以从多种语言(Java,Ruby,Python,C#...)中进行选择,这使得任何可以使用其中一种非常流行的语言进行编程的人都可以使用它,而且可以想象,您可以在iOS和Android上针对同一应用的测试之间共享代码.

There are some other advantages to using Appium - you can pick from quite a few languages (Java, Ruby, Python, C#...), which makes it accessible to anyone who can program in one of those very popular languages, and you can conceivably share code between tests for the same app on iOS and Android.

根据我的经验,尽管有很多人在使用Appium,但是社区支持水平并不能弥补令人失望的维护水平;除了Appium与Xcode兼容的脆弱性之外,我发现某些关键功能在某些绑定中仍未实现,例如在Python中滚动.

In my experience, while there are a lot of people out there using Appium, the level of community support doesn't make up for the disappointing level of maintenance; aside from the fragility of Appium's compatibility with Xcode, I've found that some key functions have remained unimplemented in some bindings, e.g. scrolling in Python.

对于UI测试,可靠性是框架中最重要的方面.没有可靠性,您就不能信任测试来标记问题,没有信任,您的测试对您和您的团队几乎没有价值.这就是为什么我建议在任何第三方框架上使用XCTest的原因.

With UI tests, reliability is the most important aspect of your framework. Without reliability, you can't trust the tests to flag up problems, and without trust, your tests provide little to no value to you and your team. This is why I recommend XCTest over any third-party framework.

使用XCTest,您不必担心无法更新Xcode版本,并且该框架符合Apple的发行标准.与所有iOS UI测试框架一样,存在一些错误(尤其是在选择器周围),但是我发现该框架的稳定性以及由Apple拥有的事实胜过了奇数错误的缺点.

With XCTest, you never have to worry about not being able to update your version of Xcode, and the framework is maintained to Apple's release standards. As with all the iOS UI testing frameworks, there are some bugs, (particularly around pickers) but I find that the stability of the framework and the fact that it's owned by Apple outweighs the disadvantages of the odd bug.

被Apple认可是使用XCTest的重要专家,因为Apple可以删除对Appium依赖的API的访问权限,并且Appium可以永远停止工作一整夜.从历史上看,Apple不会在没有至少一年的通知的情况下简单地取消对自己框架的支持.

Being endorsed by Apple is a significant pro for using XCTest, since Apple could remove access to the APIs which Appium depends on and Appium could stop working forever overnight. Historically, Apple do not simply remove support for their own frameworks without at least a year of notice.

要直接使用XCTest,您需要使用Swift(推荐)或Objective-C.没有像Appium所提供的那样多的语言选择,但是由于这两种语言都使用相同的实现,因此对它们的支持是一致的. Swift是一种强大的语言选择,尤其是对于较大的项目,因为它的类型安全性使您可以在运行时注意到许多编程错误.两种语言都在Xcode中为您提供了出色的智能感知(自动完成)支持,而诸如Python或Ruby之类的动态"语言并没有提供开箱即用的功能.

To use XCTest directly, you need to use Swift (recommended) or Objective-C. There isn't as much language choice as Appium gives, but support for both languages is consistent as they both use the same implementation. Swift is a strong choice of language, especially for larger projects, because its type-safety allows you to notice many programming errors before runtime. Both languages also give you great intellisense (autocomplete) support in Xcode, which is something that is not offered out of the box by 'dynamic' languages like Python or Ruby.

随着越来越多的信息将其与UI测试一起使用以及越来越多的人能够采用它,XCTest周围的社区正在发展.用于UI测试的框架的许多部分已经用于单元测试很多年了,因此,在添加UI测试支持之前,在许多方面,已经有很多有关使用它的信息.

The community around XCTest is growing as more information becomes available about using it with UI tests and more people feel able to adopt it. Many parts of the framework used for UI testing have been being used for many years for unit tests, so in many ways, there was already a lot of information available about using it, before the UI testing support was added.

两个框架都使用类似的概念-XCUIApplication与Appium的驱动程序相似,可让您访问屏幕上的内容.这两个框架提供的功能级别可以说非常相似,因此取决于您的优先级所在-可靠性(XCTest)或跨其他平台的可重用性以及语言可访问性(Appium).

Both frameworks use similar concepts - XCUIApplication is similar to Appium's Driver, which gives you access to what's on the screen. The level of functionality offered by both frameworks is arguably very similar, so it depends where your priorities lie - with reliability (XCTest) or reusability across other platforms and language accessibility (Appium).

这篇关于iOS自动化测试-XCTest与Appium的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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