思路:
在excel中定义用例的操作过程,因为UI用例基本都是按照元素定位先找到元素,然后操作元素,元素操作分为点击、输入等
然后python用例一行一行读取各单元格的值,使用if action==‘click’ :ele.click()的思路去根据指令做对应的执行
关键字驱动思想:
将测试数据放在外部文件,通过外部文件存储关键字,python实现读取关键字,并按照关键字执行对应的操作
代码:
def test_03(self):
'''
关键字驱动:将步骤关键字写在excel,用例读取excel,根据读取的关键字执行对应的操作
find_element selector selectot_value action input_text
find_element id com.zhao.myreader:id/iv_search click
find_element id com.zhao.myreader:id/et_search_key send_keys 长风
:return:
'''
file = xlrd.open_workbook('./device.xlsx')
sheet = file.shee