命令行運行airtest腳本注意事項


1、 pip install airtest 和pip install pocoui 時,安裝速度慢可以在后面加

可以在命令后面加參數    "-i https://pypi.tuna.tsinghua.edu.cn/simple"

資料:https://blog.csdn.net/rytyy/article/details/78088682

 

2、命令行運行airtest腳本

# 這兩個命令行的效果是相同的,我們用airtest運行了一個叫做untitled.air的腳本
>airtest run untitled.air --device Android:///手機設備號 --log log/
>python -m airtest run untitled.air --device Android:///手機設備號 --log log/

eg:airtest run C:\Users\Administrator\Desktop\UI_auto_test\AllCase\create_pro.air --device Android:///

關於--device的說明

# 什么都不填寫,會默認取當前連接中的第一台手機 Android:/// # 連接本機默認端口連的一台設備號為79d03fa的手機 Android://127.0.0.1:5037/79d03fa # 連接一個Windows窗口,窗口句柄為123456 Windows:///123456 # 連接一個Windows窗口,窗口名稱匹配某個正則表達式 Windows:///?title_re=Unity.* # 連接iOS手機 iOS:///127.0.0.1:8100 

資料:https://www.jianshu.com/p/009f7325b4bf

 

3、確認ADB是否能夠正常連接到手機

windows系統下:

    用USB線連好手機后,進入AirtestIDE文件夾,在 AirtestIDE_2019-05-09_py3_win64/airtest/core/android/static/adb/windows 目錄下按住shift+鼠標右鍵打開命令行終端,輸入 adb devices

 

4、python批量運行airtest腳本

用命令行運行腳本,不要使用pycharm運行;

步驟:打開命令行工具,cd到myRunner.py文件目錄下,然后輸入 python myRunner.py

資料:https://www.cnblogs.com/xuanjian-91/p/10375853.html

https://www.cnblogs.com/xiehong/p/11603384.html

https://blog.csdn.net/u010127154/article/details/83375659

PS:生成的報告summary.html文件中,要點擊具體某個用例,需要修改summary_template.html中的

<a href="log/{{r.name}}/log.html" target="view_window">{{r.name}}</a></td>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM