diff --git a/001-DirectSale/2-Platform/0-login.robot b/001-DirectSale/2-Platform/0-login.robot index 8d2d8ef..f2a4650 100644 --- a/001-DirectSale/2-Platform/0-login.robot +++ b/001-DirectSale/2-Platform/0-login.robot @@ -9,4 +9,4 @@ pwlogin Disable Warnings Create Session ZTBSC ${ztbops} ${ztbsc_ops_login_header} ${data} Create Dictionary username=${ztbsc_account} password=${ztbsc_password} - ${reps} Post On Session ZTBSC recycle-service/admin/login data=${data} + ${reps} Post On Session ZTBSC recycle-service/admin/login params=${data} diff --git a/002-AgentSale/2-Platform/0-login.robot b/002-AgentSale/2-Platform/0-login.robot index 8d2d8ef..f2a4650 100644 --- a/002-AgentSale/2-Platform/0-login.robot +++ b/002-AgentSale/2-Platform/0-login.robot @@ -9,4 +9,4 @@ pwlogin Disable Warnings Create Session ZTBSC ${ztbops} ${ztbsc_ops_login_header} ${data} Create Dictionary username=${ztbsc_account} password=${ztbsc_password} - ${reps} Post On Session ZTBSC recycle-service/admin/login data=${data} + ${reps} Post On Session ZTBSC recycle-service/admin/login params=${data} diff --git a/003-DirectSaleForwardFactoring/2-Platform/0-login.robot b/003-DirectSaleForwardFactoring/2-Platform/0-login.robot index 8d2d8ef..f2a4650 100644 --- a/003-DirectSaleForwardFactoring/2-Platform/0-login.robot +++ b/003-DirectSaleForwardFactoring/2-Platform/0-login.robot @@ -9,4 +9,4 @@ pwlogin Disable Warnings Create Session ZTBSC ${ztbops} ${ztbsc_ops_login_header} ${data} Create Dictionary username=${ztbsc_account} password=${ztbsc_password} - ${reps} Post On Session ZTBSC recycle-service/admin/login data=${data} + ${reps} Post On Session ZTBSC recycle-service/admin/login params=${data} diff --git a/004-DirectSaleReverseFactoring/2-Platform/0-login.robot b/004-DirectSaleReverseFactoring/2-Platform/0-login.robot index 8d2d8ef..f2a4650 100644 --- a/004-DirectSaleReverseFactoring/2-Platform/0-login.robot +++ b/004-DirectSaleReverseFactoring/2-Platform/0-login.robot @@ -9,4 +9,4 @@ pwlogin Disable Warnings Create Session ZTBSC ${ztbops} ${ztbsc_ops_login_header} ${data} Create Dictionary username=${ztbsc_account} password=${ztbsc_password} - ${reps} Post On Session ZTBSC recycle-service/admin/login data=${data} + ${reps} Post On Session ZTBSC recycle-service/admin/login params=${data} diff --git a/005-AgencyForwardFactoring/2-Platform/0-login.robot b/005-AgencyForwardFactoring/2-Platform/0-login.robot index 8d2d8ef..f2a4650 100644 --- a/005-AgencyForwardFactoring/2-Platform/0-login.robot +++ b/005-AgencyForwardFactoring/2-Platform/0-login.robot @@ -9,4 +9,4 @@ pwlogin Disable Warnings Create Session ZTBSC ${ztbops} ${ztbsc_ops_login_header} ${data} Create Dictionary username=${ztbsc_account} password=${ztbsc_password} - ${reps} Post On Session ZTBSC recycle-service/admin/login data=${data} + ${reps} Post On Session ZTBSC recycle-service/admin/login params=${data} diff --git a/006-CounterFactoring/2-Platform/0-login.robot b/006-CounterFactoring/2-Platform/0-login.robot index 8d2d8ef..f2a4650 100644 --- a/006-CounterFactoring/2-Platform/0-login.robot +++ b/006-CounterFactoring/2-Platform/0-login.robot @@ -9,4 +9,4 @@ pwlogin Disable Warnings Create Session ZTBSC ${ztbops} ${ztbsc_ops_login_header} ${data} Create Dictionary username=${ztbsc_account} password=${ztbsc_password} - ${reps} Post On Session ZTBSC recycle-service/admin/login data=${data} + ${reps} Post On Session ZTBSC recycle-service/admin/login params=${data} diff --git a/DatadrivenF.xls b/DatadrivenF.xls index 42b518d..d2042da 100644 Binary files a/DatadrivenF.xls and b/DatadrivenF.xls differ diff --git a/RF-TEST/0-Data driven/WebLogin.robot b/RF-TEST/0-Data driven/WebLogin.robot index 6c5edc5..619dcee 100644 --- a/RF-TEST/0-Data driven/WebLogin.robot +++ b/RF-TEST/0-Data driven/WebLogin.robot @@ -71,11 +71,11 @@ Factoring_Login Set Global Variable ${F_userId} Set Global Variable ${F_token} #Execl写入数据 - Open Excel D:\\LYL\\Study\\Robot_framework\\New_Trading\\数据驱动.xls + Open Excel D:\\LYL\\Study\\Robot_framework\\space\\ztb-ops-rf-api\\数据驱动.xls Put String To Cell ztbsc 3 24 {'Content-Type':'application/json','Authorization':'QNT ${F_token}','X-APP-ID':'503258978847966410','X-ORGANIZATION-ID':'710132392618233856'} #写入保理商端请求头数据 Save Excel DatadrivenF.xls #数据驱动 - Open Excel D:\\LYL\\Study\\Robot_framework\\New_Trading\\DatadrivenF.xls + Open Excel D:\\LYL\\Study\\Robot_framework\\space\\ztb-ops-rf-api\\DatadrivenF.xls ${ztbsc_factoring_header} Read Cell Data By Name ztbsc D25 #保理商端header ${ztbsc_factoring_login_header} Read Cell Data By Name ztbsc D23 #保理商端登录header Set Global Variable ${ztbsc_factoring_header} diff --git a/RF-TEST/0-Data driven/dataDriven.robot b/RF-TEST/0-Data driven/dataDriven.robot index 61d64e2..bf50b13 100644 --- a/RF-TEST/0-Data driven/dataDriven.robot +++ b/RF-TEST/0-Data driven/dataDriven.robot @@ -107,12 +107,12 @@ ztbsc #${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 - ${DataTime} Get Current Date result_format=%Y-%m-%d %H:%M:%S + #${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 + #${DataTime} Get Current Date result_format=%Y-%m-%d %H:%M:%S #转换'为空 #${List} Set Variable ['{"id":"742739866076450816"}', '{"id":"742363192650502144"}'] #${BList} Convert To String ${List} @@ -121,4 +121,29 @@ ztbsc #${List} Set Variable [{0},{1},{2},3,4,5,6,7,8,9] #${num} Evaluate random.randint(1,8) random #${data} Evaluate random.sample(${List},${num}) random - ${i} Evaluate round(random.uniform(0.005,0.02),3) random + #${i} Evaluate round(random.uniform(0.005,0.02),3) random + #IF,ELSE语句 + #${i} Set Variable None + #Run Keyword If '${i}'!='${None}' log false + #... + # ELSE log true + #IF,ELSE IF语句 [3041,3042,3043,3044] + ${ServiceFeeType} Set Variable [3041,3042,3043,3044] + ${ServiceFeeType} Evaluate random.choice(${ServiceFeeType}) random #保理服务费类型 + Run Keyword If ${ServiceFeeType}==3041 Run Keyword ServiceFee3041 + ... ELSE IF ${ServiceFeeType}==3042 Run Keyword ServiceFee3042 + ... ELSE IF ${ServiceFeeType}==3043 Run Keyword ServiceFee3043 + ... ELSE ${ServiceFeeType}==3044 Run Keyword ServiceFee3044 + +*** Keywords *** +ServiceFee3041 + ${ServiceFee} Evaluate random.randint(1000,1500) random + +ServiceFee3042 + ${ServiceFee} Evaluate round(random.uniform(0.01,0.02),3) random + +ServiceFee3043 + ${ServiceFee} Evaluate round(random.uniform(0.01,0.02),3) random + +ServiceFee3044 + ${ServiceFee} Evaluate random.randint(5,15) random diff --git a/RF-TEST/2-Platform/0-login.robot b/RF-TEST/2-Platform/0-login.robot index 8d2d8ef..f2a4650 100644 --- a/RF-TEST/2-Platform/0-login.robot +++ b/RF-TEST/2-Platform/0-login.robot @@ -9,4 +9,4 @@ pwlogin Disable Warnings Create Session ZTBSC ${ztbops} ${ztbsc_ops_login_header} ${data} Create Dictionary username=${ztbsc_account} password=${ztbsc_password} - ${reps} Post On Session ZTBSC recycle-service/admin/login data=${data} + ${reps} Post On Session ZTBSC recycle-service/admin/login params=${data} diff --git a/RF-TEST/3-Factoring/0-FactoringContract.robot b/RF-TEST/3-Factoring/0-FactoringContract.robot new file mode 100644 index 0000000..65083aa --- /dev/null +++ b/RF-TEST/3-Factoring/0-FactoringContract.robot @@ -0,0 +1,146 @@ +*** Settings *** +Library DateTime +Library Collections +Library RequestsLibrary +Library String + +*** Test Cases *** +FactoringPartner + #获取保理id + Create Session factoring ${ztbscops} ${ztbsc_header} + ${reps} GET On Session factoring ztb-user-enterprise-service/admin/scrap-paper/factor/get/factor-list params=certificationStatus=&status=&organizationName=小小保理&pageNum=1&pageSize=10 + ${FactoringId} Get From Dictionary ${reps.json()['data']['records'][0]} id #组织唯一标识 + ${organizationId} Get From Dictionary ${reps.json()['data']['records'][0]} organizationId #组织id + Set Global Variable ${FactoringId} + Set Global Variable ${organizationId} + #获取费纸厂类型保理客户数据 + Create Session factoring ${uecclient} ${ztbsc_factoring_header} + ${reps} GET On Session factoring factoring/user/get/factoring-partner-list params=pageNum=1&pageSize=30 + ${PartnerList} Get From Dictionary ${reps.json()['data']} records #保理客户列表 + FOR ${PartnerInfo} IN @{PartnerList} + ${bizRole} Get From Dictionary ${PartnerInfo} bizRole #客户组织类型 + ${PartnerId} Get From Dictionary ${PartnerInfo} id #客户id + ${PartnerName} Get From Dictionary ${PartnerInfo} name #客户name + ${PartnerOrgId} Get From Dictionary ${PartnerInfo} partnerOrgId #客户组织id + Exit For Loop If '${bizRole}'!='2' + END + Set Global Variable ${PartnerId} + Set Global Variable ${PartnerName} + Set Global Variable ${PartnerOrgId} + #获取纸厂类型保理客户数据 + Create Session factoring ${uecclient} ${ztbsc_factoring_header} + ${reps} GET On Session factoring factoring/user/get/factoring-partner-list params=pageNum=1&pageSize=30 + ${PaperPartnerList} Get From Dictionary ${reps.json()['data']} records #保理客户列表 + FOR ${PaperPartnerInfo} IN @{PaperPartnerList} + ${bizRole} Get From Dictionary ${PaperPartnerInfo} bizRole #客户组织类型 + ${PaperPartnerId} Get From Dictionary ${PaperPartnerInfo} id #客户id + ${PaperPartnerName} Get From Dictionary ${PaperPartnerInfo} name #客户name + ${PaperPartnerOrgId} Get From Dictionary ${PaperPartnerInfo} partnerOrgId #客户组织id + Exit For Loop If '${bizRole}'=='2' + END + Set Global Variable ${PaperPartnerId} + Set Global Variable ${PaperPartnerName} + Set Global Variable ${PaperPartnerOrgId} + #查询保理客户是否有银行卡 + ${reps} GET On Session factoring factoring/user/get/factoring-partner-details params=id=${PartnerId} + ${ownBankAccount} Get From Dictionary ${reps.json()['data']} ownBankAccount #客户实体银行卡信息 + ${factoringBankAccount} Get From Dictionary ${reps.json()['data']} factoringBankAccount #客户虚拟银行卡信息 + Run Keyword If ${factoringBankAccount}!=None log 已存在银行卡 + ... ELSE Run Keyword 保理客户添加银行卡 + #正向保理额度信息 + ${reps} GET On Session factoring factoring/user/get/credit-line params=factoringPartnerId=${PartnerId} + ${CreditId} Get From Dictionary ${reps.json()['data']} id #保理授信额度标识 + Run Keyword If ${CreditId}!=None log 授信额度配置已存在 + ... ELSE Run Keyword 保存正向保理授信额度 + #反向保理额度信息 + ${reps} GET On Session factoring factoring/user/get/credit-line params=factoringPartnerId=${PaperPartnerId} + ${PaperCreditId} Get From Dictionary ${reps.json()['data']} id #保理授信额度标识 + Run Keyword If ${PaperCreditId}!=None log 授信额度配置已存在 + ... ELSE Run Keyword 保存反向保理授信额度 + +ForwardContract + #获取核心企业信息 + Create Session factoring ${ztbscops} ${ztbsc_factoring_header} + ${reps} GET On Session factoring ztb-user-enterprise-service/user/get/paper-mill-list/for/option params=pageNum=1&pageSize=30 + ${PaperMillList} Get From Dictionary ${reps.json()['data']} records #核心纸业(纸厂)列表 + ${PaperMillInfo} Evaluate random.choice(${PaperMillList}) random #随机获取纸厂信息 + ${paperMillId} Get From Dictionary ${PaperMillInfo} paperMillId #核心企业id + ${paperMillName} Get From Dictionary ${PaperMillInfo} paperMillName #核心企业name + ${paperMillOrgId} Get From Dictionary ${PaperMillInfo} paperMillOrgId #核心企业组织名称 + #创建正向保理合同 + Create Session factoring ${ztbclient} ${ztbsc_factoring_header} + ${Time} Get Time #获取当前时间 + ${EndTime} Add Time To Date ${Time} 30 days + ${endDate} Get Substring ${EndTime} 0 19 + ${startDate} Set Variable ${Time} #保理合同开始时间 + ${maxPeriod} Evaluate random.randint(30,75) random #最长账期 + ${InterestRate} Evaluate round(random.uniform(8,15),1) random #年化利率(%) + ${factoringType} Set Variable [3021,3022] + ${factoringType} Evaluate random.choice(${factoringType}) random #保理类型 + ${ServiceFeeType} Set Variable [3041,3042,3043,3044] + ${ServiceFeeType} Evaluate random.choice(${ServiceFeeType}) random #保理服务费类型 + Run Keyword If ${ServiceFeeType}==3041 Run Keyword ServiceFee3041 + ... ELSE IF ${ServiceFeeType}==3042 Run Keyword ServiceFee3042 + ... ELSE IF ${ServiceFeeType}==3043 Run Keyword ServiceFee3043 + ... ELSE Run Keyword ServiceFee3044 #按车结算 #按吨结算-扣点前 #按吨结算-扣点后 #按百分比结算 + ${Contract} Set Variable { \ \ \ \ "firstPartyOrgId":"${paperMillOrgId}", \ \ \ \ "thirdPartyOrgId":"${PartnerOrgId}", \ \ \ \ "contractName":"${paperMillName}-${PartnerName}(正向)", \ \ \ \ "receiveAccountType":${factoringType}, \ \ \ \ "factoringType":3031, \ \ \ \ "maxPeriod":${maxPeriod}, \ \ \ \ "factoringServiceFeeType":${ServiceFeeType}, \ \ \ \ "factoringServiceFee":${ServiceFee}, \ \ \ \ "factoringAnnualInterestRate":${InterestRate}, \ \ \ \ "startDate":"${startDate}", \ \ \ \ "endDate":"${endDate}", \ \ \ \ "secondPartyOrgId":"${organizationId}" } + ${reps} POST On Session factoring ztb-supply-chain-service/user/create/factoring-contract ${Contract.encode('utf-8')} + +ReverseContract + #获取上游供应商信息 + #${reps} GET On Session factoring ztb-user-enterprise-service/user/page/supplier/by-keyword params=pageNum=1&pageSize=30 + #${SupplierList} Get From Dictionary ${reps.json()['data']} records #上游供应商列表 + #${SupplierInfo} Evaluate random.choice(${SupplierList}) random #随机获取上游供应商信息 + #${SupplierName} Get From Dictionary ${SupplierInfo} fullName #上游供应商name + #${SupplierOrgId} Get From Dictionary ${SupplierInfo} organizationId #上游供应商组织名称 + #创建反向保理合同 + Create Session factoring ${ztbclient} ${ztbsc_factoring_header} + ${Time} Get Time #获取当前时间 + ${EndTime} Add Time To Date ${Time} 30 days + ${endDate} Get Substring ${EndTime} 0 19 #保理合同结束时间 + ${startDate} Set Variable ${Time} #保理合同开始时间 + ${maxPeriod} Evaluate random.randint(30,75) random #最长账期 + ${InterestRate} Evaluate round(random.uniform(8,15),1) random #年化利率(%) + ${factoringType} Set Variable [3021,3022] + ${factoringType} Evaluate random.choice(${factoringType}) random #保理类型 + ${Contract} Set Variable { \ \ \ \ "contractName":"${PaperPartnerName}-${PartnerName}(反向)", \ \ \ \ "firstPartyOrgId":"${PaperPartnerOrgId}", \ \ \ \ "thirdPartyOrgId":"${PartnerOrgId}", \ \ \ \ "maxPeriod":${maxPeriod}, \ \ \ \ "receiveAccountType":${factoringType}, \ \ \ \ "factoringType":3032, \ \ \ \ "startDate":"${startDate}", \ \ \ \ "endDate":"${endDate}", \ \ \ \ "factoringAnnualInterestRate":${InterestRate}, \ \ \ \ "secondPartyOrgId":"${organizationId}" } + ${reps} POST On Session factoring ztb-supply-chain-service/user/create/factoring-contract ${Contract.encode('utf-8')} + +*** Keywords *** +保理客户添加银行卡 + #保理客户添加银行卡 + Create Session factoring ${uecclient} ${ztbsc_factoring_header} + ${Code} Evaluate random.randint(11111111,22222222) random + ${BankData} Set Variable { \ \ \ \ "bankAccountName":"${Code}", \ \ \ \ "bankName":"${Code}", \ \ \ \ "bankCardNo":"${Code}", \ \ \ \ "bankBranchName":"${Code}", \ \ \ \ "cnapsCode":"${Code}", \ \ \ \ "factorId":"${FactoringId}", \ \ \ \ "factorOrgId":"${organizationId}", \ \ \ \ "partnerId":"${PartnerId}" } + ${reps} POST On Session factoring factoring/user/create/factoring-bank-account ${BankData.encode('utf-8')} + Should Be Equal As Strings ${reps.json()['message']} successful + +保存正向保理授信额度 + #编辑保理额度 + Create Session factoring ${uecclient} ${ztbsc_factoring_header} + ${Amount} Evaluate random.randint(10000,50000) random #随机获取保理额度 + ${CreditData} Set Variable { \ \ \ \ "id":null, \ \ \ \ "creditAmount":${Amount}, \ \ \ \ "usedCreditAmount":null, \ \ \ \ "factoringType":3031, \ \ \ \ "factoringPartnerId":"${PartnerId}", \ \ \ \ "factorOrgId":"${organizationId}" } + ${reps} POST On Session factoring factoring/user/save/credit-line ${CreditData.encode('utf-8')} + +保存反向保理授信额度 + #编辑保理额度 + Create Session factoring ${uecclient} ${ztbsc_factoring_header} + ${Amount} Evaluate random.randint(100000,500000) random #随机获取保理额度 + ${CreditData} Set Variable { \ \ \ \ "id":null, \ \ \ \ "creditAmount":${Amount}, \ \ \ \ "usedCreditAmount":null, \ \ \ \ "factoringType":3032, \ \ \ \ "factoringPartnerId":"${PaperPartnerId}", \ \ \ \ "factorOrgId":"${organizationId}" } + ${reps} POST On Session factoring factoring/user/save/credit-line ${CreditData.encode('utf-8')} + +ServiceFee3041 + ${ServiceFee} Evaluate random.randint(1000,1500) random + Set Global Variable ${ServiceFee} + +ServiceFee3042 + ${ServiceFee} Evaluate round(random.uniform(0.01,0.02),3) random + Set Global Variable ${ServiceFee} + +ServiceFee3043 + ${ServiceFee} Evaluate round(random.uniform(0.01,0.02),3) random + Set Global Variable ${ServiceFee} + +ServiceFee3044 + ${ServiceFee} Evaluate random.randint(5,15) random + Set Global Variable ${ServiceFee}