You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

45 lines
1.9 KiB

*** Settings ***
Library Collections
Library ExcelLibrary
Library DatabaseLibrary
*** Test Cases ***
ReadData
Import Variables D:\\LYL\\Study\\Ptest\\用户资料\\Execl.py
#${DList} Set Variable ${cap}
log ${phone_list}
LOG ${phone}
FOR ${P} IN RANGE ${phone_list}
END
LOG ${P}
Connect_Database
[Documentation] 连接数据库
#连接数据库
Connect To Database Using Custom Params pymysql database='dating-agency-service',user='root',password='qniaothreetwoonego',host='8.135.8.221'
${UserData} Query SELECT * FROM `uec`.`qn_account` WHERE `tid` = '13517986787' AND `is_delete` = '0'
${accountId} Set Variable ${UserData[0][0]}
Disconnect From Database
ReadData-1
#读取execl表数据
Open Excel D:\\LYL\\Study\\Robot_framework\\space\\Dating-Agency\\相亲用户资料.xls
${rowCount} Get Row Count 用户资料 #获取表行数
${List} Create List
FOR ${x} IN RANGE ${rowCount -1} #读取count-1行,不读取首行
${read_row} Get Row Values 用户资料 ${x+1} #1代表execl的第一行,读完${rowCount}是一个list
Set Suite Variable ${read_row}
#\ Insert_Into_List ${List} ${x} ${row_list}
#${Count_List} Evaluate len(${List})
#Set Suite Variable ${Count_List}
#Set Suite Variable ${List}
*** Keywords ***
Keyword
#处理每行的List
${row_list} Create List
${count_column} Get Column Count 用户资料 #获取表列数
@{int_values_index} Create List ${1} ${2} ${3} ${4} ${5} ${7} ${9} ${10} ${11} ${12}
FOR ${i} IN RANGE ${count_column} #循环文本列数
${row_values} Set Variable ${read_row[${i}][1]}
${if_empty} Run Keyword And Return Status Should Be Equal As Strings ${row_values} ${empty} #判断是否为空