*** Settings *** Library urllib3 Library Collections Library RequestsLibrary Library DatabaseLibrary *** Keywords *** 查询${dating}征婚人的资料信息 #通过userid获取征婚人的资料 FOR ${userId} ${client_header} IN ZIP ${userid_list} ${Cheader_list} Create Session dating ${${dating}.dating域名} ${client_header} ${reps} GET On Session dating /dating-agency-service/user/get/marriage/information/details params=userId=${userId} ${miId} Get From Dictionary ${reps.json()['data']} id #获取资料id ${nickName} Get From Dictionary ${reps.json()['data']} nickName #获取用户名称 ${miId_list} Create List ${genderCode} Get From Dictionary ${reps.json()['data']} genderCode #用户性别 ${message} Get From Dictionary ${reps.json()} message Append To List ${miId_list} ${miId} Should Be Equal As Strings ${message} successful END Set Global Variable ${nickName} Set Global Variable ${miId_list} Set Global Variable ${genderCode} 查询${dating}征婚人资料 #通过miId查询征婚人资料 FOR ${miId} ${client_header} IN ZIP ${miId_list} ${Cheader_list} Create Session dating ${${dating}.dating域名} ${client_header} ${reps} GET On Session dating dating-agency-service/user/get/marriage/information/details/byid params=miId=${miId} ${age} Get From Dictionary ${reps.json()['data']} age #年龄 ${height} Get From Dictionary ${reps.json()['data']} height #获取征婚人身高 ${cityCode} Get From Dictionary ${reps.json()['data']} cityCode #现居城市 ${birthYear} Get From Dictionary ${reps.json()['data']} birthYear #出生年份 ${genderCode} Get From Dictionary ${reps.json()['data']} genderCode #性别 END Set Global Variable ${age} Set Global Variable ${height} Set Global Variable ${cityCode} Set Global Variable ${birthYear} Set Global Variable ${genderCode} 查看${dating}平台相亲列表 #相亲推荐页 ${ageRange} Evaluate list(range(${age}-9,${age}+10,1)) #年龄范围 ${heightRange} Evaluate list(range(${height}-20,${height}+15,1)) #身高范围 FOR ${client_header} IN @{Cheader_list} Create Session dating ${${dating}.dating域名} ${client_header} ${reps} GET On Session dating dating-agency-service/user/get/marriage/recommendation/page params=queryType=0&pageNum=1&pageSize=30 ${records} Get From Dictionary ${reps.json()['data']} records #推荐列表 Set Global Variable ${records} 遍历推荐列表 END #判断年龄是否在范围内 FOR ${a} IN @{age_list} Run Keyword If ${a} in ${ageRange} log ${a}存在于${ageRange}中 ... ELSE log ${a}不存在于${ageRange}中 END #判断身高是否在范围内 FOR ${h} IN @{height_list} Run Keyword If ${h} in ${heightRange} log ${h}存在于${heightRange}中 ... ELSE log ${h}不存在于${heightRange}中 END 遍历推荐列表 ${age_list} Create List ${height_list} Create List FOR ${data} IN @{records} ${age} Get From Dictionary ${data} age ${height} Get From Dictionary ${data} height Append To List ${age_list} ${age} Append To List ${height_list} ${height} END Set Global Variable ${age_list} Set Global Variable ${height_list} 用户查询${dating}搜索列表-无条件 #无条件搜索 FOR ${client_header} IN @{Cheader_list} Create Session dating ${${dating}.dating域名} ${client_header} ${reps} GET On Session dating dating-agency-service/user/get/marriage/recommendation/page params=advancedQuery=false&queryType=1&minAge=18&maxAge=80&minHeight=0&maxHeight=207&minimumIncome=0&maximumIncome=10000000&unlock=0&pageNum=1&pageSize=1000 ${total} Get From Dictionary ${reps.json()['data']} total Set Global Variable ${total} END 数据库查询征婚资料数量-无条件 Connect To Database Using Custom Params pymysql database='dating_agency_service',user='root',password='qniaothreetwoonego',host='8.135.8.221' ${genderCode} Set Variable If ${genderCode}==1 0 1 ${check} Query SELECT COUNT(*) FROM `dating_agency_service`.`da_marriage_information` WHERE `gender_code` = '${genderCode}' AND `profile_photo` <> 'null' AND `is_delete` = '0' #查询数据库资料数量 ${count} Set Variable ${check[0][0]} Should Be Equal As Numbers ${count} ${total} Disconnect From Database 用户查询${dating}搜索列表-未婚 #微醺条件搜索 FOR ${client_header} IN @{Cheader_list} Create Session dating ${${dating}.dating域名} ${client_header} ${reps} GET On Session dating dating-agency-service/user/get/marriage/recommendation/page params=advancedQuery=false&queryType=1&minAge=18&maxAge=80&minHeight=0&maxHeight=207&minimumIncome=0&maximumIncome=10000000&maritalStatusCode=0&unlock=0&pageNum=1&pageSize=1000 ${total} Get From Dictionary ${reps.json()['data']} total Set Global Variable ${total} END 数据库查询征婚资料数量-未婚 Connect To Database Using Custom Params pymysql database='dating_agency_service',user='root',password='qniaothreetwoonego',host='8.135.8.221' ${genderCode} Set Variable If ${genderCode}==1 0 1 ${check} Query SELECT count(*) FROM `dating_agency_service`.`da_marriage_information` WHERE `gender_code` = '${genderCode}' AND `profile_photo` <> 'null' AND `is_delete` = '0' AND `marital_status_code` = '0' #查询数据库资料数量 ${count} Set Variable ${check[0][0]} Should Be Equal As Numbers ${count} ${total} Disconnect From Database 用户查询${dating}搜索列表-现居地 #无条件搜索 region固定省市-广州 FOR ${client_header} IN @{Cheader_list} Create Session dating ${${dating}.dating域名} ${client_header} ${reps} GET On Session dating dating-agency-service/user/get/marriage/recommendation/page params=advancedQuery=false&queryType=1&minAge=18&maxAge=80&minHeight=0&maxHeight=207&minimumIncome=0&maximumIncome=10000000&provinceCode=${provinceCode}&provinceName=${provinceName}&cityCode=${cityCode}&cityName=${cityName}&unlock=0&pageNum=1&pageSize=1000 ${total} Get From Dictionary ${reps.json()['data']} total Set Global Variable ${total} END 数据库查询征婚资料数量-现居地 Connect To Database Using Custom Params pymysql database='dating_agency_service',user='root',password='qniaothreetwoonego',host='8.135.8.221' ${genderCode} Set Variable If ${genderCode}==1 0 1 ${check} Query SELECT count(*) FROM `dating_agency_service`.`da_marriage_information` WHERE `gender_code` = '${genderCode}' AND `profile_photo` <> 'null' AND `is_delete` = '0' AND `province_code` = '${provinceCode}' AND `province_name` = '${provinceName}' AND `city_code` = '${cityCode}' AND `city_name` = '${cityName}' #查询数据库资料数量 ${count} Set Variable ${check[0][0]} Should Be Equal As Numbers ${count} ${total} Disconnect From Database region固定省市-广州 Disable Warnings Create Session region http://qncloud.oss-cn-shenzhen.aliyuncs.com ${reps} GET On Session region address.json ${local_data} Get From Dictionary ${reps.json()} data FOR ${province} IN @{local_data} #省列表数据 ${provinceCode} Get From Dictionary ${province} value #获取省编码 ${provinceName} Get From Dictionary ${province} label #获取省名称 Exit For Loop If '${provinceName}'=='广东省' END ${city_data} Get From Dictionary ${province} children #广东省市列表数据 FOR ${city} IN @{city_data} ${cityCode} Get From Dictionary ${city} value #获取市编码 ${cityName} Get From Dictionary ${city} label #获取市名称 Exit For Loop If '${cityName}'=='广州市' END ${district_data} Get From Dictionary ${city} children #广州市列表数据 log ${district_data} ${district} Evaluate random.choice(${district_data}) random ${districtCode} Get From Dictionary ${district} value #随机获取广州市区编码 ${districtName} Get From Dictionary ${district} label #随机获取广州市区名称 Set Global Variable ${cityCode} Set Global Variable ${cityName} Set Global Variable ${districtCode} Set Global Variable ${districtName} Set Global Variable ${provinceCode} Set Global Variable ${provinceName} 用户查询${dating}搜索列表-学历 #微醺条件搜索 选择婚介征婚人的学历 FOR ${client_header} IN @{Cheader_list} Create Session dating ${${dating}.dating域名} ${client_header} ${reps} GET On Session dating dating-agency-service/user/get/marriage/recommendation/page params=advancedQuery=false&queryType=1&minAge=18&maxAge=80&minHeight=0&maxHeight=207&minimumIncome=0&maximumIncome=10000000&educationCode=${educationCode}&education=${education}&unlock=0&pageNum=1&pageSize=1000 ${total} Get From Dictionary ${reps.json()['data']} total Set Global Variable ${total} END 数据库查询征婚资料数量-学历 Connect To Database Using Custom Params pymysql database='dating_agency_service',user='root',password='qniaothreetwoonego',host='8.135.8.221' ${genderCode} Set Variable If ${genderCode}==1 0 1 ${check} Query SELECT count(*) FROM `dating_agency_service`.`da_marriage_information` WHERE `gender_code` = '${genderCode}' AND `profile_photo` <> 'null' AND `is_delete` = '0' AND `education_code` = '${educationCode}' AND `education` = '${education}' #查询数据库资料数量 ${count} Set Variable ${check[0][0]} Should Be Equal As Numbers ${count} ${total} Disconnect From Database 选择${dating}征婚人的学历 #获取学历列表 FOR ${client_header} IN @{Cheader_list} Create Session dating ${${dating}.dating域名} ${client_header} ${reps} GET On Session dating dating-agency-service/user/get/education/list ${data_list} Get From Dictionary ${reps.json()} data ${education_data} Evaluate random.choice(${data_list}) random #随机获取学历 #${education_data} Get From List ${data_list} 3 #0高中以下,1中专,2大专,3本科。4硕士,5博士 ${education} Get From Dictionary ${education_data} desc #学历名称 ${educationCode} Get From Dictionary ${education_data} value #学历编码 Set Global Variable ${education} Set Global Variable ${educationCode} END