继读Excel文件后,需要把Excel列表对应的运行结果返回一个状态True/False,再放入一个list中,最后循环读这个list写到txt文件的结果中,方便查看
写文件要用到读文件时候的list,所以这里也吧读文件和运行过程贴出来
Excel文件总共有两列
读文件方法如下,不做过多解释,详细可查看我的读文件博客
for_myExcel
#######读Excel文件,并保存为list
open_Excel C:\\Users\\whoami\\Desktop\\read_file.xls
@{read_columnA} get_column_values mytext 0
@{read_columnB} get_column_values mytext 1
#log ${read_columnA[${x}][${y}]}
#log ${read_columnB[${x}][${y}]}
${y} set_Variable 1 #读取文件后,list示例[A2,u'hedi']
${count_row} get_row_count mytext #get_row_count/get_column_count 获取文本行/列数
Set_Suite_Variable ${count_row}
#log ${count_row}
@{a_list} create_list
@{b_list} create_list
: FOR ${x} IN RANGE ${count_row}
\ ${a} set_variable ${read_columnA[${x}][${y}]}
\ ${b} set_variable ${read_columnB[${x}][${y}]}
\ #${a_list} Evaluate '${a_list}'.append(${a}) #使用Evaluate方法支持python代码
\ #${a_list} Evaluate '${b_list}'.append(${b})
\ Append_to_list ${a_list} ${a} #Append_to_list需要Collections库支持
\ Append_to_list ${b_list} ${b}
Set_Suite_Variable ${a_list}
Set_Suite_Variable ${b_