1. 程式人生 > >微信小程式自動化測試全流程(安卓真機+Appium)

微信小程式自動化測試全流程(安卓真機+Appium)

一、連線手機
1.手機設定成開發者模式(我用的oppo,所以是設定-關於手機-三擊“版本號”,開發者模式開啟)
2.開啟USB除錯(設定-其它設定-開發者選項-USB除錯開啟,最好不鎖螢幕和不使用鎖屏)
3.此時資料線是與電腦連線 的,手機端會出現“允許除錯嗎?”的提示,點選“確定”
二、檢查Appium與手機是否可正常連結
1.cmd,錄入adb devices,出現下圖紅框標識資訊,證明手機已連線成功
這裡寫圖片描述
2.此時開啟Appium,啟動,出現下圖所示資訊,appium與手機連線成功
這裡寫圖片描述
注:若出現Appium啟動報錯:

Checking if an update is available
Update not available
Starting Node Server
error: Couldn’t start Appium REST http interface listener. Requested port is already in use. Please make sure there’s no other instance of Appium running already.

Node Server Process Ended
解決方案是:Windows下,殺掉node.exe32程序,再重啟Appium即可解決)
三、python編寫進入小程式指令碼,可參考以下連結
https://testerhome.com/topics/14927
但注意shell 命令後要加“”
adb shell “dumpsys activity top | grep ACTIVITY”
adb shell “ps 23498”

未完待續。。。