問題描述
我有一個(gè)使用跨平臺(tái)開發(fā)工具開發(fā)的應(yīng)用程序.這個(gè)應(yīng)用程序有相同的界面為 ios(ipa) 和 android(apk).我可以編寫一個(gè)自動(dòng)化腳本并在兩個(gè)平臺(tái)上運(yùn)行它,即適用于 android 和 ios 應(yīng)用程序.
I have one application that is developed using cross platform development tool. This app has same interface for ios(ipa) and android(apk). Can I write one automation script and run it across both the platforms i.e both for android and ios app.
有人用 Appium 試過嗎?開發(fā)跨平臺(tái)測(cè)試的測(cè)試腳本需要使用哪些定位技術(shù).例如,通過 tagName、xpath ?
Anyone tried this using Appium ? What are the locating techniques that need to be used for developing test scripts for cross platform testing. e.g by tagName, xpath ?
使用 appium 進(jìn)行跨平臺(tái)測(cè)試有什么限制?
What are the limitations with appium for cross platform testing?
推薦答案
所以,跨平臺(tái)的意思是 Sencha 對(duì)?
So, cross platform means Sencha right?
問題一:-是的,Appium 支持混合以及原生 iOS/Android 應(yīng)用程序.
Que 1:- Yes, Appium support to hybrid as well as native iOS/Android app.
對(duì)于自動(dòng)化,您可以在 iOS 和 Android 上重復(fù)使用相同的代碼(但要小心謹(jǐn)慎).請(qǐng)參閱第六個(gè)答案
for automation you can reuse same code for both iOS and Android(But take it with pinch of salt). Please see 6th answer here
查看這個(gè) github 鏈接 https://github.com/appium/appium.
Check out this github link https://github.com/appium/appium.
問題2:-
定位元素:-您也可以使用索引、resource_id、文本和 XPath.
Locating elements :- you can use indexes, resource_id, text, and XPath also.
1.索引 :- 假設(shè)你想獲得按鈕的索引.Appium 將特定類型的元素視為數(shù)組.從上到下,從左到右開始計(jì)算索引(button[0],button1 ...).
1. Indexes :- Suppose you want to get index of buttons. Appium treat specific types of elements as array. Start counting of indexes(button[0],button1 ... ) from top to bottom, left to right.
- uiautomatorviewer :- 將您的移動(dòng)設(shè)備連接到桌面并啟動(dòng)您的應(yīng)用程序.在桌面終端中使用
uiautomatorviewer
命令(請(qǐng)確保您已為工具、平臺(tái)工具、構(gòu)建工具和adb devices
設(shè)置了所有 ANDROID_HOME 路徑,顯示所有附加設(shè)備列表).
- uiautomatorviewer :- connect you mobile device to desktop and launch your app.
In desktop terminal use
uiautomatorviewer
command (please make sure you have all ANDROID_HOME path set for tools, platform-tools, build-tools andadb devices
showing all attached devices list).
它會(huì)打開一個(gè)窗口,點(diǎn)擊最右邊的截圖按鈕.將鼠標(biāo)懸停在屏幕截圖上的元素上,您將看到所有按索引、resource_id、文本和 XPath 列出的元素
It will open a window, click on right most take a screenshot button. Hover on elements present on screenshot you will see all elements by indexes, resource_id, text, and XPath
限制 :- Appium 到現(xiàn)在還有點(diǎn)不穩(wěn)定.Android 4.2+ 支持 uiautomatorviewer
而低版本使用 Selendroid
limitations :- Appium is Little bit unstable till now.
Android 4.2+ supports to uiautomatorviewer
while for lower version use Selendroid
對(duì)于跨平臺(tái),您需要根據(jù)您的平臺(tái)(iOS/Android)和設(shè)備版本和運(yùn)行平臺(tái)更改代碼capabilities
.
for cross platform you need to change code capabilities
based on your platform(iOS/Android) and device version and running platforms.
請(qǐng)參閱博客以獲取幫助 http:///swapnilvkotwal.wordpress.com/2014/04/04/appium-setup-ruby-sample-test-script/
See blog for help http://swapnilvkotwal.wordpress.com/2014/04/04/appium-setup-ruby-sample-test-script/
這篇關(guān)于Appium : 能否用于跨平臺(tái)應(yīng)用測(cè)試的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!