仲天
首页
(current)
分类
Go
Python
自动化脚本
xTS(谷歌认证测试)
Selenium
软件测试
Redis
Mysql
Docker
MongoDB
Jquery
Nginx
Bootstrap
Linux
正则表达式
bat
cmd批处理
截图
作者分享
JSON
SEO
在线工具
搜索
对于谷歌认证测试(xTS),分享一下自己在工作中编写的一些脚本。
2022-07-20 14:20:55
409
本文章为原创文章,转载请附上原文地址,谢谢。
算上实习,我在安卓测试工作岗位上已经做了近4年了,而在xTS模块测试中有差不多2年多时间。如今我已经换工作岗位,我想这辈子或许再也不会接触xTS、GTS、VTS、STS、Verififer等等测试了吧,曾经很努力很努力的学习相关知识,想想过程中付出的所有,对于我来说都是一种收获!现在我已经重新启航,进入了一个新的工作岗位。加油! 推荐一个在线工具网站:[在线工具大全](https://www.zztdd.cn) **xTS自动化执行:** 1.配置文件: ``` [config] test_item = GTS executed_file = ../tools/gts-tradefed executed_command = run gts -m GtsSimAppDialogTestCases -t com.google.android.simappdialog.gts.InstallCarrierAppActivityTest#testNotificationOnlyDuringSetupWizard -s BH950020JN executed_command_1 = gts full_run_number = 1 device_number = 3 device1 = device2 = device3_uicc = 设备SN号 device4_se = 设备SN号 device5_sim = 设备SN号 device_set_all = 设备SN号 ``` 2.python 部分代码(全部代码请访问:[all code](https://github.com/zztroot/xtsTest)) ```python import os import time import re try: from bs4 import BeautifulSoup import configparser from prettytable import PrettyTable except: os.system("pip3 install bs4") os.system("pip3 install configparser") os.system("pip3 install prettytable") time.sleep(1) from bs4 import BeautifulSoup import configparser from prettytable import PrettyTable def executed_xts(runfile, command, seconds): time.sleep(2) run = 'gnome-terminal -- ' + runfile + ' ' + command width = os.get_terminal_size().columns print("*".center(width, '*')) os.system(run) time.sleep(seconds) files = os.listdir("../results/") files = sorted(files) if len(files) % 2 == 0: if len(files) >= 2: return files[-2] else: return files[0] elif len(files) % 2 == 1: return files[-1] def if_result_done(resul_file): files_zip = "../results/" + resul_file + ".zip" if os.path.exists(files_zip): return resul_file else: return "not done" def check_results(file_name): filepath = os.getcwd() path = re.findall("(.*?).autoXts", filepath) new_path = path[0] url = os.path.join(new_path + "/results/" + file_name + "/test_result_failures_suite.html") with open(url, 'r') as f: soup = BeautifulSoup(f.read(), 'lxml').html result_pass = re.findall('.*?<td class="rowtitle">Tests Passed</td>.*?>(.*?)</.*?', str(soup)) result_fail = re.findall('.*?<td class="rowtitle">Tests Failed</td>.*?>(.*?)</.*?', str(soup)) result_module_done = re.findall('.*?<td class="rowtitle">Modules Done</td>.*?>(.*?)</.*?', str(soup)) result_module_total = re.findall('.*?<td class="rowtitle">Modules Total</td>.*?>(.*?)</.*?', str(soup)) results_list = [result_pass[0], result_fail[0], result_module_done[0], result_module_total[0]] if result_fail[0] == "0": return results_list, "done" fail_module_name = re.findall('.*?<td class="module" colspan="3"><a.*?>.*?(C.*?)</a>.*?', str(soup)) se_cases = "CtsSecureElementAccessControlTestCases1" or \ "CtsSecureElementAccessControlTestCases2" or \ "CtsSecureElementAccessControlTestCases3" or \ "CtsSecureElementAccessControlTestCases1[instant]" or \ "CtsSecureElementAccessControlTestCases2[instant]" or \ "CtsSecureElementAccessControlTestCases3[instant]" or \ "VtsHalSecureElementV1_0Target" if se_cases in fail_module_name: return results_list, "se" sim_cases = "CtsTelecomTestCases" or \ "CtsTelecomTestCases2" or \ "CtsTelecomTestCases3" or \ "CtsTelephony2TestCases" or \ "CtsTelephony2TestCases[instant]" or \ "CtsTelephony3TestCases" or \ "CtsTelephonyProviderTestCases" or \ "CtsTelephonySdk28TestCases" or \ "CtsTelephonyTestCases" or \ "CtsPermissionTestCasesTelephony" or \ "CtsPermissionTestCasesTelephony[instant]" or \ "GtsTelephonyTestCases" or \ "GtsTelecomManagerTests" or \ "VtsHalAudioEffectV5_0Target" or \ "VtsHalAudioV2_0Target" or \ "VtsHalAudioV5_0Target" or \ "VtsHalRadioConfigV1_0Target" if sim_cases in fail_module_name: return results_list, "sim" uicc_cases = "CtsCarrierApiTestCases" or "GtsSimAppDialogTestCases" if uicc_cases in fail_module_name: return results_list, "uicc" return results_list, "all" ```
版权声明:本文为仲天原创文章,转载请附上原文出处链接和本声明。
本文链接:
文章分类
Go
Python
自动化脚本
xTS(谷歌认证测试)
Selenium
软件测试
Redis
Mysql
Docker
MongoDB
Jquery
Nginx
Bootstrap
Linux
正则表达式
bat
cmd批处理
截图
作者分享
JSON
SEO
推荐文章
Go中gorm批量保存数据
227
推荐一个在线免费工具网站,简单,好用
394
Python获取当前时间日期,时间格式化以及常用的时间操作
574
基于Go、Gin、Redis、Mysql、Vue、TS、Vite、ElementPlus开发的后台管理系统。
516
uiautomator2+adb shell input tap 实现微博自动取消关注
460
优选网站
在线JSON工具
在线音频提取
Linux在线大全
PDF转WORD
TCP/IP端口大全