問題描述
我正在尋找測試工程師和 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 時都會中斷.這不太可能改變,因為 Apple 現在維護自己的 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.
隨著關于將 XCTest 用于 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的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!