本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
在自訂測試環境中使用 devicefarm-cli 工具
測試主機使用稱為 的標準化版本管理工具 devicefarm-cli來選取軟體版本。此工具與 分開, AWS CLI 僅適用於 Device Farm 測試主機。使用 devicefarm-cli,您可以在測試主機上切換到任何預先安裝的軟體版本。這提供了一種直接的方式,可讓您在一段時間內維護 Device Farm 測試規格檔案,並為您提供可預測的機制,讓您在未來升級軟體版本。
重要
此命令列工具不適用於舊版 iOS 主機。如需詳細資訊,請參閱 上的 主題舊版 iOS 測試主機。
以下程式碼片段顯示 的help頁面devicefarm-cli:
$ devicefarm-cli help Usage: devicefarm-cli COMMAND [ARGS] Commands: help Prints this usage message. list Lists all versions of software configurable via this CLI. use <software> <version> Configures the software for usage within the current shell's environment.
讓我們使用 來檢閱幾個範例devicefarm-cli。若要使用 工具將測試規格檔案中的 Python 版本從 3.10 變更為 3.9,請執行下列命令:
$ python --version Python 3.10.12 $ devicefarm-cli use python 3.9 $ python --version Python 3.9.17
若要將 Appium 版本從 1 變更為 2:
$ appium --version 1.22.3 $ devicefarm-cli use appium 2 $ appium --version 2.1.2
提示
請注意,當您選取軟體版本時, devicefarm-cli也會切換這些語言的支援工具,例如pip適用於 Python 和npm適用於 NodeJS 的工具。
如需測試主機上預先安裝軟體的詳細資訊,請參閱 自訂測試環境中支援的軟體。