標籤:roi com view install 包管理 device xamarin 頁面 tomat
安裝環境:
1、安裝visual studio,並勾上Xamarin.外掛程式 ,或者在工具-nuget包管理工具下安裝外掛程式:
PM> Install-Package Xamarin.UITest -Version 2.0.9
PM> Install-Package Xamarin.TestCloud.Agent -Version 0.20.6 ##ios
PM> Install-Package NUnitTestAdapter -Version 2.1.1
2、安裝xamarin test recorder。
使用xamarin :參考:https://developer.xamarin.com/guides/testcloud/uitest/quickstarts/
定位元素:
1、使用uiautomatorviewer定位,很多元素定位不到。說是因為頁面是H5的原因,建議用chrome瀏覽器。
2、使用chrome瀏覽器,在手機端安裝chrome,開啟後,進入百度。
在電腦上開啟chrome,輸入chrome://inspect/#devices,chrome裡面的元素可以定位。但是apk裡面的元素還是不能定位:顯示the tab is inactive。。。後面找到原因再更新。
3、開啟vs的repl,輸入tree命令,查看命令視窗第一行顯示的日子檔案。記錄檔裡有元素的定位。
[Test]
//This starts up a typically very useful C# REPL that can be used to identify the UI elements.
public void FirstUnitTest()
{
app.Repl();
}
4、使用xamarin test recorder 功能,
開啟xamarin test recorder,在test檔案的左邊一個像漏鬥的小按鈕(行號的左邊一點),進行錄製。操作元素。錄製的指令碼雖然有問題,但是可以定位元素。
手勢操作:https://developer.xamarin.com/guides/testcloud/uitest/working-with/gestures/
建立項目:Visual C# ---測試 -----UI測試應用(xamarin.ui test | android)
在VS上用Xamarin C#進行app自動化測試