簡要框架設計圖

目前簡易框架目錄

其中:
cmd_deivces.py 是設備管理類,設備相關信息處理都放在此類中
cmd_command.py 是公共方法類,測試用例的相關處理都放在此類中
exc_testcases.py 是測試用例類,測試用例都放在此類中
現階段主要快速適用于適配線項目而設計
exc_testcases.py
# author=Five # coding=utf-8 from cmd_command import cmd_command as cc from random import randint # 執行點擊事件 def rand_tap_test(a, b): step.exec_tap(a, b) # 執行滑動事件 def rand_swipe_test(c, e, d, f): step.exec_swipe(c, e, d, f) # 執行輸入事件 def rand_text_test(text): step.exec_text(text) # 所有互聯卡片及區域隨機點擊 def test_all_area():
# 600表示我們需要執行的測試次數 for i in range(1, 600): # 右側投屏區域控制 x = randint(180, 1900) y = randint(20, 700) # 右側投屏區域滑動控制 x1 = randint(730, 1100) x2 = randint(1101, 1790) y1 = randint(90, 450) y2 = randint(451, 700) # systemUI區域控制 xx = randint(180, 550) xy = randint(80, 690) flag = i % 10
# 控制各事件的觸發比例 if flag in (2, 4, 6, 8, 10):
# 調用點擊事件 rand_tap_test(xx, xy) elif flag in (1, 7):
# 調用滑動事件 rand_swipe_test(x1, x2, y1, y2) else:
# 調用點擊事件 rand_tap_test(x, y) if __name__ == "__main__": step = cc() test_all_area()
主要設計思路:在指定區域內模擬手動點擊和滑動等快速操作,保證可以只在關注的某一個功能內進行測,做持續化測試。
可以在exc_testcases.py中自定義方法,用于具體模塊部分業務能力的自動化測試。
備注:重點是要確定點擊和滑動的坐標區域范圍
浙公網安備 33010602011771號