pythonwebview自动化测试_GitHub - githubwzg/python-appium: 基于PageObject UI自动化测试框架,支持Android/iOS...
0910 UPDATE
新增控件集參數(shù)化,相同測試步驟的Android/iOS可共用一份測試用例
不同測試步驟的用例還需要單獨(dú)寫
0904 UPDATE
優(yōu)化Android log及crsahinfo相關(guān)輸出路徑
新增iOS crashreport解析
新增內(nèi)容:
適配iOS
提取android crash信息
優(yōu)化report(增加自動填充包名,app名稱,版本,bundleId等信息)
簡介
采用python3+appium1.8,基于PageObject框架的UI自動化測試持續(xù)集成。
unittest參數(shù)化
PageObject分層管理
用例編寫基于yaml配置多關(guān)鍵字驅(qū)動
自動生成excel測試報告
同時支持Android/iOS
支持多設(shè)備執(zhí)行
支持Windows/Mac OS (iOS必須使用Mac OS)
目錄結(jié)構(gòu)
1.app
待測apk/ipa 安裝包路徑
uiautomator2等安裝包路徑
2.Base
Android 測試相關(guān):
BaseAdb.py
BaseAndroidPhone.py
BaseApk.py
BaseLog.py
BaseLogcat.py
iOS 測試相關(guān):
BaseIosPhone.py
BaseIpa.py
BaseIosLog.py
數(shù)據(jù)處理相關(guān):
BaseConfig.py
BaseExcel.py
BaseFile.py
BasePickle.py
BaseYaml.py
BaseOperate.py
BaseReplace.py
測試執(zhí)行相關(guān):
BaseAppiumServer.py
BaseInit.py
BaseRunner.py
BaseElements.py
報告相關(guān):
BaseStatisics.py
BaseError.py
BaseEmail.py
3. iOSCrashAnalysis
iOS crash report ?解析相關(guān):
BaseIosCrash.py 解析腳本
FileOperate.py 文件操作相關(guān)
symbolicatecrash xCode自帶的解析工具,獲取方式:find /Applications/Xcode.app -name symbolicatecrash -type f,復(fù)制過來就行了
4.Log
設(shè)備日志及持久化數(shù)據(jù)
操作日志,失敗截圖
crash解析結(jié)果
5.PageObject
操作的封裝及測試結(jié)果統(tǒng)計
測試用例模塊分級
6.其他
../Report =====測試報告
../Runner =====執(zhí)行文件
../TestCase =====測試用例集
../yamls =====用例管理
主要功能
1.基礎(chǔ)測試類及方法
獲取apk/ipa安裝包信息
獲取Android/iOS設(shè)備信息
自動分配端口并啟動appiumserver
設(shè)備日志及crashlog分析
失敗重試
失敗截圖
報告統(tǒng)計及輸出
郵件發(fā)送
case管理
常用操作封裝
其他
2.yaml編寫說明
testinfo: 表示用例介紹
- id: 用例id
- title: 用例標(biāo)題
- info: 前置條件
testcase: 用例的執(zhí)行步驟
- element_info: //XCUIElementTypeStaticText[@name="剪輯"] 元素
- find_type: id 元素類型
- id
- xpath
- name
- text
- ids 需要增加index
- index 和ids/xpaths/texts等配合
- class_name
- ios_id
- predicate
- operate_type: click 操作
- click
- swipe_down
- swipe_up
- get_value
- set_value
- screen_tap
- swipe_left
- swipe_right
- msg 傳給set_value關(guān)鍵字
- adb_tab 使用adb中的tab命令點(diǎn)擊元素,元素必須可識別,應(yīng)用于懸浮層場景
- get_content_desc 無法切換到webview時,用此關(guān)鍵字
- press_key_code 鍵盤觸發(fā)事件,需要傳code
- code 傳給press_key_code關(guān)鍵字
- is_webview:1 為1表示切換到webview,為2表示切換到原生
- 其他關(guān)鍵字 用于定制一些特殊業(yè)務(wù)
- is_time: 3 自定義暫停3秒
- info: 點(diǎn)擊動態(tài)列表第一條數(shù)據(jù) 操作步驟介紹
- check: 檢查點(diǎn),支持多檢查點(diǎn)
- element_info: //XCUIElementTypeStaticText[@name="剪輯"]
- find_type: ids
- index: 0
- operate_type:
- contrary" 相反檢查點(diǎn),表示如果檢查元素存在就說明失敗,如刪除后,此元素依然存在
- contrary_getval 檢查點(diǎn)關(guān)鍵字contrary_getval: 相反值檢查點(diǎn),如果對比成功,說明失敗
- default_check 默認(rèn)檢查點(diǎn),就是查找頁面元素
- compare 歷史數(shù)據(jù)和實(shí)際數(shù)據(jù)對比
- toast toast檢查
- info: 查找是否存在歷史記錄
3.yaml實(shí)例
==========================================================
testinfo:
- id: home_test_001
title: 啟動app并進(jìn)入gallery
info: 打開app并點(diǎn)擊高級編輯
testcase:
- element_info: camerta_n
find_type: ios_id
operate_type: click
info: 點(diǎn)擊創(chuàng)作中心主按鈕
- element_info: //XCUIElementTypeStaticText[@name="剪輯"]
find_type: xpath
operate_type: click
info: 點(diǎn)擊剪輯按鈕
- element_info: 跳過
find_type: name
operate_type: click
info: 跳過升級頁面
- element_info: //XCUIElementTypeStaticText[@name="剪輯"]
find_type: xpath
operate_type: click
info: 點(diǎn)擊剪輯按鈕
- element_info: 好
find_type: name
operate_type: click
info: 授權(quán)存儲
- element_info: 好
find_type: name
operate_type: click
info: 授權(quán)相冊
check:
- element_info: //XCUIElementTypeButton[@name="下一步"]
find_type: xpath
check: default_check
info: 進(jìn)入'Gallery'頁面成功
4.某個用例的page層
from PageObject import Pages
class PageOperate:
def __init__(self, kwargs):
_init = {"driver": kwargs["driver"], "test_msg": getYam(kwargs["path"]), "device": kwargs["device"],
"logTest": kwargs["logTest"], "platformName": kwargs["platformName"],"caseName": kwargs["caseName"]}
self.page = Pages.PagesObjects(_init)
def operate(self): # 操作步驟
self.page.operate()
def checkPoint(self): # 檢查點(diǎn)
self.page.checkPoint()
5.testcase層調(diào)用page層
tc_temp = PATH("../yamls/temp.yaml")
el_android = PATH("../yamls/el_android.yaml")
el_iOS = PATH("../yamls/el_iOS.yaml")
class HomeTest(ParametrizedTestCase):
def repalce(self, tc, tc_temp):#用了最笨的替換字符串方法,輸出一個臨時temp.yaml文件,測試完成后再刪除
if self.platformName == 'android':
ReplaceYaml(tc, tc_temp, el_android)
elif self.platformName == 'iOS':
ReplaceYaml(tc, tc_temp, el_iOS)
def testFirstOpen(self):
tc = PATH("../yamls/home/firstOpen.yaml")
self.repalce(tc, tc_temp)
app = {"logTest": self.logTest, "driver": self.driver, "path": tc_temp,
"device": self.udid, "platformName": self.platformName, "caseName": sys._getframe().f_code.co_name}
page = PageOperate(app)
page.operate()
page.checkPoint()
def testSecondOpen(self):
tc = PATH("../yamls/home/secondOpen.yaml")
self.repalce(tc, tc_temp)
app = {"logTest": self.logTest, "driver": self.driver, "path": tc_temp,
"device": self.udid, "platformName": self.platformName, "caseName": sys._getframe().f_code.co_name}
page = PageOperate(app)
page.operate()
page.checkPoint()
6.Case入口
def runnerCaseApp(devices):
starttime = datetime.now()
suite = unittest.TestSuite()
suite.addTest(ParametrizedTestCase.parametrize(HomeTest, param=devices))
# suite.addTest(ParametrizedTestCase.parametrize(HomeTest, param=devices)) #加入測試類
unittest.TextTestRunner(verbosity=2).run(suite)
endtime = datetime.now()
countDate(datetime.now().strftime('%Y-%m-%d %H:%M:%S'), str((endtime - starttime).seconds) + "秒")
7.實(shí)時日志展示
testFirstOpen (TestCase.HomeTest.HomeTest) ... ==操作步驟:com.quvideo.xiaoying:id/xiaoying_alert_dialog_positive_click ==
==操作步驟:com.android.packageinstaller:id/permission_allow_button_click ==
==操作步驟:com.android.packageinstaller:id/permission_allow_button_click ==
==操作步驟:com.quvideo.xiaoying:id/wel_skip_click ==
==操作步驟:com.quvideo.xiaoying:id/layout_fragment_creation_click ==
==操作步驟:com.quvideo.xiaoying:id/icon1_click ==
==操作步驟:text("跳過")_click ==
==操作步驟:com.quvideo.xiaoying:id/icon1_click ==
==操作步驟:text("其他相冊")_ ==
Platform: android
Device: 4ed397ac
==用例_啟動app并進(jìn)入gallery檢查點(diǎn)成功==
ok
8.操作日志輸出展示
2018-08-23 11:51:08,390 - INFO - ---- home_test_001_啟動app并進(jìn)入gallery_com.quvideo.xiaoying:id/xiaoying_alert_dialog_positive_click ----
2018-08-23 11:51:09,711 - INFO - ---- home_test_001_啟動app并進(jìn)入gallery_com.android.packageinstaller:id/permission_allow_button_click ----
2018-08-23 11:51:10,583 - INFO - ---- home_test_001_啟動app并進(jìn)入gallery_com.android.packageinstaller:id/permission_allow_button_click ----
2018-08-23 11:51:19,866 - INFO - ---- home_test_001_啟動app并進(jìn)入gallery_com.quvideo.xiaoying:id/wel_skip_click ----
2018-08-23 11:51:23,644 - INFO - ---- home_test_001_啟動app并進(jìn)入gallery_com.quvideo.xiaoying:id/layout_fragment_creation_click ----
2018-08-23 11:51:29,023 - INFO - ---- home_test_001_啟動app并進(jìn)入gallery_com.quvideo.xiaoying:id/icon1_click ----
2018-08-23 11:51:30,361 - INFO - ---- home_test_001_啟動app并進(jìn)入gallery_text("跳過")_click ----
2018-08-23 11:51:33,660 - INFO - ---- home_test_001_啟動app并進(jìn)入gallery_com.quvideo.xiaoying:id/icon1_click ----
2018-08-23 11:51:35,636 - INFO - ---- home_test_001_啟動app并進(jìn)入gallery_text("其他相冊")_ ----
2018-08-23 11:51:35,698 - INFO - [CheckPoint_1]: testFirstOpen_ : OK
2018-08-23 11:51:52,341 - INFO - ---- home_test_002_進(jìn)入拍攝頁面_com.quvideo.xiaoying:id/img_creation_click ----
2018-08-23 11:51:54,148 - INFO - ---- home_test_002_進(jìn)入拍攝頁面_com.quvideo.xiaoying:id/icon2_click ----
2018-08-23 11:51:55,116 - INFO - ---- home_test_002_進(jìn)入拍攝頁面_text("允許")_click ----
2018-08-23 11:51:56,704 - INFO - ---- home_test_002_進(jìn)入拍攝頁面_text("總是允許")_click ----
2018-08-23 11:51:57,834 - INFO - ---- home_test_002_進(jìn)入拍攝頁面_text("總是允許")_click ----
2018-08-23 11:52:01,559 - INFO - ---- home_test_002_進(jìn)入拍攝頁面_text("高清相機(jī)")_ ----
2018-08-23 11:52:01,647 - INFO - [CheckPoint_2]: testSecondOpen_ : OK
9.crash解析-android
=========================crash================================
06-20 13:41:06.165 7638 7638 E AndroidRuntime: Process: com.quvideo.xiaoying, PID: 7638
06-20 13:41:06.165 7638 7638 E AndroidRuntime: java.lang.NullPointerException: Attempt to read from field 'int com.quvideo.xiaoying.datacenter.social.publish.PublishTaskInfo.step' on a null object reference
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.quvideo.xiaoying.app.publish.d.a.aI(SourceFile:67)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.quvideo.xiaoying.app.publish.d.a.aK(SourceFile:123)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.quvideo.xiaoying.app.publish.d.a.a(SourceFile:151)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.quvideo.xiaoying.app.publish.SocialPublishBaseActivity.da(SourceFile:1531)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.quvideo.xiaoying.app.publish.SocialPublishBaseActivity.aaM(SourceFile:1565)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.quvideo.xiaoying.app.publish.c.b$1.acg(SourceFile:312)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.quvideo.xiaoying.videoeditor.j.a.a$4.m(SourceFile:650)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.quvideo.xiaoying.ui.dialog.c.onClick(SourceFile:165)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at android.view.View.performClick(View.java:6291)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at android.view.View$PerformClick.run(View.java:24931)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:808)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:101)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at android.os.Looper.loop(Looper.java:166)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7425)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
06-20 13:41:06.367 732 732 E wificond: Failed to get NL80211_RATE_INFO_NOISE
06-20 13:41:06.367 732 732 E wificond: Failed to get NL80211_RATE_INFO_SNR
06-20 13:41:06.367 732 732 E wificond: Failed to get NL80211_STA_INFO_CNAHLOAD
06-20 13:41:07.841 1157 1174 I chatty : uid=1000(system) android.ui expire 3 lines
06-20 13:41:07.851 1448 1780 I HwNetworkPolicyManager: getHwUidPolicy uid = 10063 policy = 0
06-20 13:41:07.878 1157 2823 I chatty : uid=1000(system) Binder:1157_F expire 1 line
06-20 13:41:07.879 1157 1350 I chatty : uid=1000(system) ConnectivitySer expire 14 lines
06-20 13:41:07.879 1157 8282 I chatty : uid=1000(system) Binder:1157_1B expire 10 lines
06-20 13:41:07.893 1157 8281 I chatty : uid=1000(system) Binder:1157_1A expire 12 lines
06-20 13:41:07.900 17940 17940 I ActivityThread: Removing dead content provider:android.content.ContentProviderProxy@b3b0cdb
06-20 13:41:07.911 1157 14597 I chatty : uid=1000(system) Binder:1157_1F expire 9 lines
06-20 13:41:07.936 1157 1167 I chatty : uid=1000(system) Binder:1157_1 expire 14 lines
=========================crash=========================
06-20 13:41:06.165 7638 7638 E AndroidRuntime: Process: com.quvideo.xiaoying, PID: 7638
06-20 13:41:06.165 7638 7638 E AndroidRuntime: java.lang.NullPointerException: Attempt to read from field 'int com.quvideo.xiaoying.datacenter.social.publish.PublishTaskInfo.step' on a null object reference
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.quvideo.xiaoying.app.publish.d.a.aI(SourceFile:67)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.quvideo.xiaoying.app.publish.d.a.aK(SourceFile:123)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.quvideo.xiaoying.app.publish.d.a.a(SourceFile:151)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.quvideo.xiaoying.app.publish.SocialPublishBaseActivity.da(SourceFile:1531)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.quvideo.xiaoying.app.publish.SocialPublishBaseActivity.aaM(SourceFile:1565)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.quvideo.xiaoying.app.publish.c.b$1.acg(SourceFile:312)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.quvideo.xiaoying.videoeditor.j.a.a$4.m(SourceFile:650)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.quvideo.xiaoying.ui.dialog.c.onClick(SourceFile:165)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at android.view.View.performClick(View.java:6291)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at android.view.View$PerformClick.run(View.java:24931)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:808)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:101)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at android.os.Looper.loop(Looper.java:166)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7425)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
06-20 13:41:06.165 7638 7638 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
06-20 13:41:06.367 732 732 E wificond: Failed to get NL80211_RATE_INFO_NOISE
06-20 13:41:06.367 732 732 E wificond: Failed to get NL80211_RATE_INFO_SNR
06-20 13:41:06.367 732 732 E wificond: Failed to get NL80211_STA_INFO_CNAHLOAD
06-20 13:41:07.841 1157 1174 I chatty : uid=1000(system) android.ui expire 3 lines
06-20 13:41:07.851 1448 1780 I HwNetworkPolicyManager: getHwUidPolicy uid = 10063 policy = 0
06-20 13:41:07.878 1157 2823 I chatty : uid=1000(system) Binder:1157_F expire 1 line
06-20 13:41:07.879 1157 1350 I chatty : uid=1000(system) ConnectivitySer expire 14 lines
06-20 13:41:07.879 1157 8282 I chatty : uid=1000(system) Binder:1157_1B expire 10 lines
06-20 13:41:07.893 1157 8281 I chatty : uid=1000(system) Binder:1157_1A expire 12 lines
06-20 13:41:07.900 17940 17940 I ActivityThread: Removing dead content provider:android.content.ContentProviderProxy@b3b0cdb
06-20 13:41:07.911 1157 14597 I chatty : uid=1000(system) Binder:1157_1F expire 9 lines
06-20 13:41:07.936 1157 1167 I chatty : uid=1000(system) Binder:1157_1 expire 14 lines
06-20 13:41:07.942 1157 1367 I chatty : uid=1000(system) CallbackHandler expire 2 lines
06-20 13:41:07.958 1157 1182 I chatty : uid=1000(system) android.display expire 1 line
10. crash解析-iOS
============開始導(dǎo)出crashreport==========
idevicecrashreport -u 5214866ccb9342f87f4c2aab093c25f7e252fd85 /Users/zhulixin/Desktop/python-appium/Log/CrashInfo/iOS/Before/
Move: WiFi/WiFiManager/wifi-buf-05-23-2018__18:35:55.107.log
Move: WiFi/WiFiManager/wifi-buf-08-12-2018__02:40:07.213.log
Move: WiFi/WiFiManager/wifi-buf-05-06-2018__21:15:54.957.log
Move: WiFi/WiFiManager/wifi-buf-06-19-2018__05:16:04.564.log
Move: WiFi/WiFiManager/wifi-buf-06-16-2018__10:05:31.097.log
Move: WiFi/WiFiManager/wifi-buf-11-04-2017__14:36:48.log
Move: WiFi/WiFiManager/wifi-buf-12-03-2017__14:31:53.log
Move: WiFi/WiFiManager/wifi-buf-11-14-2017__22:41:35.log
Move: WiFi/WiFiManager/wifi-buf-05-13-2018__23:07:34.084.log
Move: WiFi/WiFiManager/wifi-buf-06-19-2018__08:05:54.196.log
Move: WiFi/WiFiManager/wifi-buf-01-23-2018__23:50:53.018.log
Move: WiFi/WiFiManager/wifi-buf-12-03-2017__15:54:45.log
Move: WiFi/WiFiManager/wifi-buf-04-10-2018__14:33:15.105.log
Move: WiFi/WiFiManager/wifi-buf-08-12-2018__20:34:03.165.log
Move: WiFi/WiFiManager/wifi-buf-08-24-2018__02:50:49.140.log
.....
.....
Move: XiaoYing-2018-07-30-114612.ips
Move: XiaoYing-2018-07-30-162434.ips
Move: XiaoYing-2018-07-28-123234.ips
Move: XiaoYing-2018-09-04-102545.ips
Move: XiaoYing-2018-07-31-095526.ips
Move: XiaoYing-2018-07-31-151350.ips
Move: XiaoYing-2018-09-04-102545.ips
Move: XiaoYing-2018-07-30-113126.ips
Move: XiaoYing-2018-07-30-114612.ips
Move: com.apple.appstored/appstored.log
Done.
============開始解析待測app相關(guān)crashreport==========
輸入的文件為: /Users/zhulixin/Desktop/python-appium/Log/CrashInfo/iOS/Before/XiaoYing-2018-07-30-114612.ips
輸出的文件為:
0x100c24000 - 0x102ff3fff XiaoYing arm64 <2deaa9887c173bb0a9f4b051e47f04a3> /var/containers/Bundle/Application/170BDC50-F0D3-4973-9781-D414532E21CD/XiaoYing.app/XiaoYing
2DEAA988-7C17-3BB0-A9F4-B051E47F04A3
'/dSYMs/XiaoYing.app.dSYM'
輸入的文件為: /Users/zhulixin/Desktop/python-appium/Log/CrashInfo/iOS/Before/XiaoYing-2018-07-30-162434.ips
輸出的文件為:
0x100290000 - 0x10265ffff XiaoYing arm64 <2deaa9887c173bb0a9f4b051e47f04a3> /var/containers/Bundle/Application/C5855F55-13D0-49FE-ADC2-7C82565237D0/XiaoYing.app/XiaoYing
2DEAA988-7C17-3BB0-A9F4-B051E47F04A3
'/dSYMs/XiaoYing.app.dSYM'
......
......
============crashreport解析完成==========
============刪除所有解析之前的crash文件==========
/Users/zhulixin/Desktop/python-appium/Log/CrashInfo/iOS/Before/JetsamEvent-2018-09-04-104135.ips was removed!
Directory: /Users/zhulixin/Desktop/python-appium/Log/CrashInfo/iOS/Before/JetsamEvent-2018-09-04-104135.ips was removed!
Directory: /Users/zhulixin/Desktop/python-appium/Log/CrashInfo/iOS/Before/WiFi was removed!
/Users/zhulixin/Desktop/python-appium/Log/CrashInfo/iOS/Before/XiaoYing-2018-07-30-114612.ips was removed!
Directory: /Users/zhulixin/Desktop/python-appium/Log/CrashInfo/iOS/Before/XiaoYing-2018-07-30-114612.ips was removed!
/Users/zhulixin/Desktop/python-appium/Log/CrashInfo/iOS/Before/XiaoYing-2018-07-30-162434.ips was removed!
Directory: /Users/zhulixin/Desktop/python-appium/Log/CrashInfo/iOS/Before/XiaoYing-2018-07-30-162434.ips was removed!
/Users/zhulixin/Desktop/python-appium/Log/CrashInfo/iOS/Before/XiaoYing-2018-09-04-102545.ips was removed!
Directory: /Users/zhulixin/Desktop/python-appium/Log/CrashInfo/iOS/Before/XiaoYing-2018-09-04-102545.ips was removed!
Directory: /Users/zhulixin/Desktop/python-appium/Log/CrashInfo/iOS/Before/com.apple.appstored was removed!
/Users/zhulixin/Desktop/python-appium/Log/CrashInfo/iOS/Before/XiaoYing-2018-07-30-184609.ips was removed!
......
......
Process finished with exit code 0
11.最終log輸出信息及路徑
12.報告輸出
1.Android
2.iOS
運(yùn)行環(huán)境
Windows 7及以上 / OSX
Android SDK的執(zhí)行環(huán)境
python3.x
Appium 1.7.x及以上
代碼獲取
最新的穩(wěn)定代碼會推送到github上,直接clone即可使用。
git@github.com:Lemonzhulixin/python-appium.git
執(zhí)行注意事項(xiàng)
1.安裝包路徑指定:Base.BaseInit
apkPath = PATH("../app/VivaVideo_7.2.5.apk") # 測試的app路徑
ipaPath = PATH("../app/xiaoying.ipa") # 測試的app路徑
2.為了避免同一臺PC上同時連接android和iOS設(shè)備時,獲取設(shè)備問題,將runner文件兩個平臺分開處理
Android執(zhí)行: python3 ../Runner/runner.py
iOS執(zhí)行:python3 ../Runner/runner_iOS.py
3.在過濾待測app crashreport時,記得在runner_iOS.py中修改待測app crashreport文件關(guān)鍵字
find_str = 'XiaoYing-' # 待測app crashreport文件關(guān)鍵字
4.過濾待測app系統(tǒng)日志,修改待測app關(guān)鍵字,如此處的'XiaoYing'
#獲取系統(tǒng)日志,過濾當(dāng)前app的log,如不需要獲取系統(tǒng)日志,注掉即可
syslog_path = os.path.join(PATH("../Log/CrashInfo/iOS/"), "syslog.log")
sys_cmd = 'idevicesyslog -u ' + get_phone["udid"] + " |grep 'XiaoYing' > %s" % (syslog_path)
os.popen(sys_cmd)
目前的遺留問題
email郵件發(fā)送尚未調(diào)試
多設(shè)備執(zhí)行還有點(diǎn)問題
當(dāng)遇到有些用例比較麻煩,必須單獨(dú)寫page層
因?yàn)閷ython的map方法不是很懂,所以控件集參數(shù)化用了最原始,最笨的字符串替換,輸出一個臨時temp.yaml文件,測試完成后再刪除;如果有對map熟悉的同學(xué),歡迎幫忙寫個方法來處理,感謝!
后續(xù)計劃
測試數(shù)據(jù)DB存儲
結(jié)果集分析
總結(jié)
以上是生活随笔為你收集整理的pythonwebview自动化测试_GitHub - githubwzg/python-appium: 基于PageObject UI自动化测试框架,支持Android/iOS...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 获得代理ippython_Python搭
- 下一篇: 鸿蒙第一款手机,拿下“国内第一手机商”的