在VS上用Xamarin C#進行app自動化測試

來源:互聯網
上載者:User

標籤: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自動化測試

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.