- (持续更新中!!!)
- 1. Instrumentation介绍
- 2. 框架设计思路(本地执行版本)
- 3. 框架设计部件说明
- 3.1 配置
Google的介绍:使用命令行运行测试
当您使用 Android 调试桥 (adb) 从命令行运行测试时,您可以获得比任何其他方法更多的选项来选择要运行的测试。您可以选择单独的测试方法,根据测试注解筛选测试,或指定测试选项。由于测试任务完全由命令行控制,因此您可以通过各种方式使用 Shell 脚本自定义测试。
2. 框架设计思路(本地执行版本) 3. 框架设计部件说明 3.1 配置要通过命令行运行测试,请运行 adb shell 以在设备或模拟器上启动命令行 shell,然后在 shell 中运行 am instrument 命令。您可以使用命令行标志控制 am 和您的测试。
此处的配置表示的是所要执行的脚本声明。存储在xml文件中(conf.xml),框架内存在解析此文件的函数(read_task)
conf.xml
解析函数:read_task
def read_task():
device = "aaa"
config_path = "./conf.xml"
try:
_msg = {'device': device, 'target_class': [], 'target_method': []}
tree = ET.parse(config_path)
root = tree.getroot()
elements = [element for element in root.iter('class')]
for no, element in enumerate(elements):
temp_method = []
methods = [method for method in element.iter('method')]
if methods:
temp_method = [i.attrib['name'] for i in methods]
_msg['target_class'].append(element.attrib['name'])
_msg['target_method'].append(temp_method)
return _msg
except Exception as e:
log.logger.error("Parse Config file fail - {0}".format(repr(e)))
输出为(此输出格式将被用于后面执行逻辑):
{'device': 'aaa', 'target_class': ['com.xx.fwtest.test123.test123', 'com.xx.fwtest.test123.test1234'], 'target_method': [['testcase_1', 'testcase_2'], []]}



