*** Settings *** Library ExcelLibrary Library DateTime Library String Library Collections Library RequestsLibrary Library urllib3 Library DatabaseLibrary *** Test Cases *** ztbsc #数据驱动 Open Excel D:\\LYL\\Study\\Robot_framework\\New_Trading\\数据驱动.xls ${uecops} Read Cell Data By Name ztbsc B10 #uec系统域名 ${pscops} Read Cell Data By Name ztbsc B15 #psc系统域名 ${ztbops} Read Cell Data By Name ztbsc B11 #ztb域名 ${ztbscops} Read Cell Data By Name ztbsc B13 #ztbsc域名 ${uecclient} Read Cell Data By Name ztbsc B2 #uec客户端域名 ${ztbclient} Read Cell Data By Name ztbsc B4 #client域名 Set Global Variable ${uecops} Set Global Variable ${pscops} Set Global Variable ${ztbops} Set Global Variable ${ztbscops} Set Global Variable ${uecclient} Set Global Variable ${ztbclient} ${ztbsc_header} Read Cell Data By Name ztbsc D10 #平台header ${client_header} Read Cell Data By Name ztbsc D2 #客户端header ${client_login_header} Read Cell Data By Name ztbsc D7 #客户端登录header ${ztbsc_traders_header} Read Cell Data By Name ztbsc D18 #代理商端header ${ztbsc_papermill_header} Read Cell Data By Name ztbsc D21 #纸厂端header ${ztbsc_factoring_header} Read Cell Data By Name ztbsc D25 #保理商端header ${ztbsc_ops_login_header} Read Cell Data By Name ztbsc D10 #平台登录header ${client_firstlogin_header} Read Cell Data By Name ztbsc D8 #客户端首次登录header ${ztbsc_traders_login_header} Read Cell Data By Name ztbsc D16 #代理商端登录header ${ztbsc_papermill_login_header} Read Cell Data By Name ztbsc D20 #纸厂端登录header ${ztbsc_factoring_login_header} Read Cell Data By Name ztbsc D23 #保理商端登录header Set Global Variable ${ztbsc_header} Set Global Variable ${client_header} Set Global Variable ${client_login_header} Set Global Variable ${ztbsc_traders_header} Set Global Variable ${ztbsc_papermill_header} Set Global Variable ${ztbsc_factoring_header} Set Global Variable ${ztbsc_ops_login_header} Set Global Variable ${client_firstlogin_header} Set Global Variable ${ztbsc_traders_login_header} Set Global Variable ${ztbsc_papermill_login_header} Set Global Variable ${ztbsc_factoring_login_header} ${ztbsc_account} Read Cell Data By Name Account password A4 #平台登录账号 ${client_account} Read Cell Data By Name Account password A3 #移动端登录账号 ${ztbsc_password} Read Cell Data By Name Account password B4 #平台登录密码 ${client_password} Read Cell Data By Name Account password B2 #移动端登录密码 ${traders_account} Read Cell Data By Name Account password A2 #代理商端登录账号 ${traders_password} Read Cell Data By Name Account password B2 #代理商端登录密码 ${papermill_account} Read Cell Data By Name Account password A2 #纸厂端登录账号 ${factoring_account} Read Cell Data By Name Account password A2 #保理商端登录账号 ${papermill_password} Read Cell Data By Name Account password B2 #纸厂端登录密码 ${factoring_password} Read Cell Data By Name Account password B2 #保理商端登录密码 Set Global Variable ${ztbsc_account} Set Global Variable ${client_account} Set Global Variable ${ztbsc_password} Set Global Variable ${client_password} Set Global Variable ${traders_account} Set Global Variable ${traders_password} Set Global Variable ${papermill_account} Set Global Variable ${factoring_account} Set Global Variable ${papermill_password} Set Global Variable ${factoring_password} ${start_time} get current date result_format=%Y-%m-%d ${str_end_time} Add Time To Date ${start_time} 30 days ${end_time} Get Substring ${str_end_time} 0 10 ${time} Get Time Set Global Variable ${start_time} Set Global Variable ${end_time} Set Global Variable ${time} 001样例 #C:\\test\\11.xls Evaluate random.randint(100, sys.maxsize) modules=random, sys #上传磅单图片 #Disable Warnings #${filepath} Evaluate open('./21042217001449712.png','rb') #${image} Evaluate open('./21042217001449712.png','rb') #${file} Create Dictionary filepath=${filepath} image=${image} #Create Session order ${ztbops} #${reps} POST On Session order recycle-user-center/upload/image files=${file} #${pictures} Get From Dictionary ${reps.json()} data #Should Be Equal As Strings ${reps.json()['message']} successful #${datatime} get current date result_format=%Y-%m-%d %H:%M:%S #${value} Set Variable 1 #${Time} Add Time To Date ${datatime} ${value} days #${DataTime} Get Substring ${Time} 0 19 #Execl写入数据 #Open Excel D:\\LYL\\Study\\Robot_framework\\New_Trading\\11.xls #Put String To Cell ztbsc 3 20 {'Authorization':'11','X-APP-ID':' 503258978847966406','X-ORGANIZATION-ID':'723518259651022848'} #Save Excel D:\LYL\Study\Robot_framework\New_Trading\11.xls #上传MP4文件 #Disable Warnings #${file} Evaluate open('./5e7f47fb6aea3.mp4','rb') #${file_data} Create Dictionary file=${file} #${type_data} Create Dictionary type='mp4' #Create Session ztbt ${ztbops} #${reps} POST On Session ztbt recycle-user-center/upload/file data=${type_data} files=${fileData} #${data} Get From Dictionary ${reps.json()} data #Set Global Variable ${data} #sleep 0.5 #获取随机数 #${List} Set Variable [{0},{1},{2},3,4,5,6,7,8,9] #${data} Evaluate random.choice(${List}) random #Log To Console ${data} #获取时间 ${time} Get Time #获取当前时间 ${start_time} Add Time To Date ${time} 02:00:00 ${start_time} Get Substring ${start_time} 0 19 ${end_time} Add Time To Date ${time} 1 day ${end_time} Get Substring ${end_time} 0 19