問題描述
我正在尋找測(cè)試工程師和 iOS 開發(fā)人員對(duì)特定問題的意見.
I am looking for opinions from test engineers and iOS developers regarding a specific matter.
我已經(jīng)使用 Appium 一年多了,在真實(shí)設(shè)備上運(yùn)行移動(dòng) Web 測(cè)試時(shí)遇到了各種困難.每次 Apple 在 XCTest 或 Safari 中進(jìn)行更改時(shí),Appium 都會(huì)受到直接影響(即使他們修復(fù)了某些問題,也會(huì)出現(xiàn)一些其他問題),并且已經(jīng)到了我要花更多時(shí)間解決 Appium 相關(guān)問題的地步與來自 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.
此外,無論如何,您都需要一臺(tái) Apple 計(jì)算機(jī)來開發(fā)和執(zhí)行 Appium iOS 測(cè)試.所以我想為什么不直接使用 XCTest 使用 Swift 或 XCTest 支持的任何語言編寫測(cè)試呢?
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 等)自動(dòng)化測(cè)試經(jīng)驗(yàn)的人的評(píng)論和意見.
I would very much appreciate comments and opinions from people who have experience with both Appium and XCTest (Swift, etc) automated tests.
與 XCTest 相比,使用 Appium 自動(dòng)化 iOS 原生和 Web 應(yīng)用程序測(cè)試有哪些優(yōu)勢(shì)?
What are the advantages of using Appium to automate iOS native and web apps tests over XCTest?
推薦答案
正如您已經(jīng)發(fā)現(xiàn)的那樣,Appium 的最大缺點(diǎn)之一是它是一個(gè)第三方框架,并且?guī)缀趺看?Apple 發(fā)布 Xcode 時(shí)都會(huì)中斷.這不太可能改變,因?yàn)?Apple 現(xiàn)在維護(hù)自己的 UI 測(cè)試框架.
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 還有其他一些優(yōu)勢(shì) - 您可以從多種語言(Java、Ruby、Python、C#...)中進(jìn)行選擇,這使得任何可以使用其中一種非常流行的語言進(jìn)行編程的人都可以使用它,并且您可以想象在 iOS 和 Android 上同一應(yīng)用的測(cè)試之間共享代碼.
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.
根據(jù)我的經(jīng)驗(yàn),雖然有很多人在使用 Appium,但社區(qū)支持水平并不能彌補(bǔ)令人失望的維護(hù)水平;除了 Appium 與 Xcode 兼容性的脆弱性之外,我發(fā)現(xiàn)一些關(guān)鍵功能在某些綁定中仍未實(shí)現(xiàn),例如在 Python 中滾動(dòng).
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.
對(duì)于 UI 測(cè)試,可靠性是框架中最重要的方面.沒有可靠性,您就無法信任測(cè)試來標(biāo)記問題,而沒有信任,您的測(cè)試對(duì)您和您的團(tuán)隊(duì)幾乎沒有價(jià)值.這就是我推薦 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,您永遠(yuǎn)不必?fù)?dān)心無法更新您的 Xcode 版本,并且該框架按照 Apple 的發(fā)布標(biāo)準(zhǔn)進(jìn)行維護(hù).與所有 iOS UI 測(cè)試框架一樣,存在一些錯(cuò)誤(尤其是在選擇器周圍),但我發(fā)現(xiàn)框架的穩(wěn)定性和它歸 Apple 擁有的事實(shí)超??過了奇怪錯(cuò)誤的缺點(diǎn).
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 的認(rèn)可是使用 XCTest 的重要優(yōu)勢(shì),因?yàn)?Apple 可以移除對(duì) Appium 所依賴的 API 的訪問權(quán)限,而 Appium 可能會(huì)在一夜之間永遠(yuǎn)停止工作.從歷史上看,Apple 不會(huì)在至少一年通知的情況下簡(jiǎn)單地取消對(duì)自己框架的支持.
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 提供的語言選擇那么多,但是對(duì)這兩種語言的支持是一致的,因?yàn)樗鼈兌际褂孟嗤膶?shí)現(xiàn).Swift 是一種強(qiáng)有力的語言選擇,尤其是對(duì)于大型項(xiàng)目而言,因?yàn)樗念愋桶踩栽试S您在運(yùn)行前發(fā)現(xiàn)許多編程錯(cuò)誤.這兩種語言還在 Xcode 中為您提供了出色的智能感知(自動(dòng)完成)支持,這是 Python 或 Ruby 等動(dòng)態(tài)"語言無法提供的.
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.
隨著關(guān)于將 XCTest 用于 UI 測(cè)試的信息越來越多,并且越來越多的人覺得能夠采用它,圍繞 XCTest 的社區(qū)正在不斷壯大.用于 UI 測(cè)試的框架的許多部分多年來一直用于單元測(cè)試,因此在許多方面,在添加 UI 測(cè)試支持之前,已經(jīng)有很多關(guān)于使用它的信息.
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.
兩個(gè)框架使用相似的概念 - XCUIApplication 類似于 Appium 的驅(qū)動(dòng)程序,它使您可以訪問屏幕上的內(nèi)容.兩個(gè)框架提供的功能級(jí)別可以說非常相似,因此這取決于您的優(yōu)先級(jí)在哪里 - 可靠性 (XCTest) 或跨其他平臺(tái)的可重用性和語言可訪問性 (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).
這篇關(guān)于iOS 自動(dòng)化測(cè)試 - XCTest 與 Appium的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!