android模擬器(genymotion)+appium+python 架構執行基本原理(目前公司自己寫的)

來源:互聯網
上載者:User

標籤:

android模擬器(genymotion)+appium+python 架構執行的基本過程:

1、Push.initDate(openid)方法     //業務資料初始化

  1.1   v5db.push_to_db(filename, openid) //通過執行filename檔案裡sql語句,使業務資料初始化,比如物理刪除訂單,以確保不會因為資料原因導致自動化執行失敗

2、Android.Android.init_Android(self)  //初始化Android模擬器 

class android:    def init_Android(self):        try:               desired_caps = {}            desired_caps[‘deviceName‘] = ‘device‘              desired_caps[‘platformName‘] = ‘Android‘            desired_caps[‘platformVersion‘] = ‘4.3‘              desired_caps[‘app‘] = PATH(‘D:\\Workspace\\projectName_app_appium_test\projectNameApp\\agent4.0.0_test.apk‘) 
       desired_caps[‘appPackage‘] = ‘com.***.finance.agent‘
       desired_caps[‘appActivity‘] = ‘com.***.finance.agent.LuncherActivity‘
       desired_caps[‘unicodeKeyboard‘] = ‘True‘
       desired_caps[‘resetKeyboard‘] = ‘True‘
  
     return desired_caps

except Exception,ex:

print ex

3、web.Web.webPath(self, androidMap)     //將app相關資訊塞到遠程虛擬機器啟動並執行appium上,從而獲得期望的driver

  driver = webdriver.Remote(‘http://127.0.0.1:4723/wd/hub‘, androidMap)

4、Push.controller(driver)   //正式開始執行case

  4.1 讀取case映射表,映射出case的描述

  4.2 if執行case在映射表中可以匹配到,則 按行讀取case檔案內容,並處理case內容 

          處理case內容,分別獲得執行時所需參數1)ids_key->ids:元素id    2)ele_type:元素類型    3)input_Value:輸入內容  4)msg:步驟描述資訊  5)assert_message:校正資訊

  4.3 調用Push.fillElement(driver,ids,ele_type,input_Value,msg,assert_message)   //定位元素,並對其進行操作

         4.3.1 定位元素

   4.3.2 對元素進行操作

   4.3.3 Push.checkResut(driver, times,  msg, assertMsg, input_value)  //寫元素動作記錄

5、case檔案執行完成,driver。quit()  //關閉driver

6、push.logInfo(time)   //輸出case測試報告

 

android模擬器(genymotion)+appium+python 架構執行基本原理(目前公司自己寫的)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.