*** Settings *** Documentation 创建常规订单 Library RequestsLibrary Library Collections Library DateTime Library RedisLibrary *** Variables *** ${header} {'content-type':'application/json','X-APP-ID':'470236309865238528'} *** Test Cases *** get-factorylist #${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${gettoken} Create Session factorylist http://api-client-ztb-test.qniao.cn ${header} ${reps} Get On Session factorylist recycle-service/get/paper-mill-paper-category-price-list params=cityId=&enableSalesAgent=1&pageNum=1&pageSize=10&listType=0 #log ${reps.json()} #Set Global Variable ${reps} Should Be Equal As Strings ${reps.json()["message"]} successful log ${reps.json()["data"]["records"]} ${categoryid} Get From Dictionary ${reps.json()["data"]["records"][0]["paperCategoryList"][1]} categoryId #纸厂品类id ${unitPrice} Get From Dictionary ${reps.json()["data"]["records"][0]["paperCategoryList"][1]} unitPrice #纸厂品类价格 ${cumulativeWeight} Get From Dictionary ${reps.json()["data"]["records"][0]} cumulativeWeight #累计已代卖吨数 Set Global Variable ${categoryid} Set Global Variable ${unitPrice} 链接redis #连接redis ${redis_conn}= Connect To Redis 8.135.8.221 6379 2 qnredis ${data} Get From Redis ${redis_conn} 1234567890 ${redis_data} Get From Redis ${redis_conn} PAPER_MILL_ID get-carinfo #获取使用过的车辆信息 ${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${gettoken} Create Session get-carinfo http://api-client-ztb-test.qniao.cn ${header} ${reps} Get On Session get-carinfo recycle-service/proxy-sell/get/his-car-info log ${reps.json()} ${carNumber} Get From Dictionary ${reps.json()["data"]} records ${plateNumber1} Evaluate random.choice(${carNumber}) random log to console \nvalue:${plateNumber1} ${plateNumber} Get From Dictionary ${plateNumber1} plateNumber #车辆信息 Set Global Variable ${plateNumber} choose-factory ${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${gettoken} Create Session choose-factory https://api-client-ztb-test.qniao.cn ${header} ${reps} Get On Session choose-factory recycle-service/get/paper-mill-paper-category-price-details/612629674392162304 log ${reps.json()["data"]} Should Be Equal As Strings ${reps.json()["message"]} successful createorder #下单 ${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=QNT ${gettoken} ${datatime} get current date result_format=%Y-%m-%d log ${datatime} ${data} Set Variable {"paperCategoryId":"${categoryid}" ,"unitPrice":${unitPrice},"totalEstimatedWeight":30000,"customerName":"赖勇兰","deliveryTime":"${datatime}","carInfos":[{"plateNumber":"${plateNumber}"}]} log ${data} Create Session createorder http://api-client-ztb-test.qniao.cn ${header} ${reps} Post On Session createorder recycle-service/proxy-sell/create/order ${data.encode('utf-8')} log ${reps.json()} Should Be Equal As Strings ${reps.json()["message"]} successful Set Global Variable ${datatime} #sleep 10