Browse Source

优化

pull/5/head
赖勇兰 4 years ago
parent
commit
52f321d432
16 changed files with 0 additions and 959 deletions
  1. 13
      0-Database.robot
  2. 45
      3-pabotdemo/1-get_list.robot
  3. 36
      3-pabotdemo/login.txt
  4. 12
      4-Data-comparison/1-Formula-calculation.robot
  5. 12
      DemoApp/APP_login.robot
  6. 6
      DemoApp/Keyword.txt
  7. 0
      DemoApp/__init__.robot
  8. BIN
      DemoApp/app-release.apk
  9. 0
      Resource/__init__.robot
  10. 35
      Resource/关键字.txt
  11. 25
      Resource/关键字使用.robot
  12. 657
      pabot_results/0/output.xml
  13. 2
      pabot_results/0/robot_stderr.out
  14. 18
      pabot_results/0/robot_stdout.out
  15. 52
      pabotdemo/添加银行卡.robot
  16. 46
      pabotdemo/登录关键字.txt

13
0-Database.robot

@ -1,13 +0,0 @@
*** Settings ***
Library DatabaseLibrary
*** Test Cases ***
Connect to database
#连接数据库
Connect To Database Using Custom Params pymysql host='8.135.8.221',user='root', password='password', \ port=3306,database='ztb_recycle' #连接数据库
${username} Query SELECT * FROM `ztb_recycle`.`qn_user` WHERE `real_name` LIKE '%赖勇兰%' #查找数据库ztb_recycle,表qn_user中real_name是赖勇兰的所有数据
log many ${username}
#Execute Sql String DELETE FROM `ztb_recycle`.`qn_user` WHERE `real_name` LIKE '%赖勇兰%' AND `id` = 584452885719420928 #删除数据
#Execute Sql String UPDATE `ztb_recycle`.`qn_user` SET `nick_name` = 'GGG' WHERE `id` = 597492076942331904 #修改数据
#Query SELECT * FROM `ztb_recycle`.`qn_user` WHERE `real_name` LIKE '%赖勇兰%' into outfile 'C:/Users/qniao/Desktop/测试.xls'
Disconnect From Database #断开数据库的连接

45
3-pabotdemo/1-get_list.robot

@ -1,45 +0,0 @@
*** Settings ***
Library RequestsLibrary
Library Collections
Library DateTime
Library redis
Library urllib3
Library pabot.pabotlib
Resource login.txt
*** Variables ***
*** Test Cases ***
a
userlogin {"accountType":2,"password":null,"account":"15014242835","captcha":"888888"}
userlogin {"accountType":2,"password":null,"account":"13333333333","captcha":"888888"}
login-token ${token}
get-factorylist
#获取代卖列表
${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${token}
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
Should Be Equal As Strings ${reps.json()["message"]} successful
${records} Get From Dictionary ${reps.json()["data"]} records #获取代卖纸厂列表
FOR ${item} IN @{records}
${name} Get From Dictionary ${item} name #获取纸厂name
${paperCategoryList} Get From Dictionary ${item} paperCategoryList #获取纸厂品类列表
${cumulativeWeight} Get From Dictionary ${item} cumulativeWeight #累计已代卖吨数
${paperMillId} Get From Dictionary ${item} paperMillId #获取纸厂id
${locProvinceName} Get From Dictionary ${item} locProvinceName #纸厂所在省
${locCityName} Get From Dictionary ${item} locCityName #纸厂所在市
${locDistrictName} Get From Dictionary ${item} locDistrictName #纸厂所在区
Exit For Loop If '${name}'=='九一纸厂有限公司'
END
${value} Evaluate random.choice(${paperCategoryList}) random
log to console \nvalue: ${value}
${categoryid} Get From Dictionary ${value} categoryId #纸厂品类id
${categoryName} Get From Dictionary ${value} categoryName #纸厂品类name
${unitPrice} Get From Dictionary ${value} unitPrice #纸厂品类价格
${paperMillAddress} Catenate ${locProvinceName} ${locCityName} ${locDistrictName}
Set Global Variable ${categoryid}
Set Global Variable ${unitPrice}
Set Global Variable ${paperMillId}
Set Global Variable ${paperMillAddress}
Set Global Variable ${categoryName}

36
3-pabotdemo/login.txt

@ -1,36 +0,0 @@
*** Settings ***
Library RequestsLibrary
Library Collections
Library urllib3
Library DatabaseLibrary
*** Variables ***
${url} http://api-client-ztb-test.qniao.cn
*** Keywords ***
userlogin
[Arguments] ${data}
#验证码登录
Disable Warnings
${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528
Create Session ZTBT https://api-client-uec-test.qniao.cn ${header}
${data} Create Dictionary account=15014242835 captcha=888888 accountType=2
#${data} Set Variable {"accountType":2,"password":null,"account":"15014242835","captcha":"${text_code}"}
${respones} POST On Session ZTBT uec/authorize/by-captcha json=${data}
log ${respones.status_code}
log ${respones.json()}
${token} Get From Dictionary ${respones.json()["data"]} token
Set Global Variable ${token}
[Teardown]
login-token
[Arguments] ${token}
${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528
Create Session ZTBT ${url} ${header}
${token1} Create Dictionary loginToken=${token}
${reps} Post On Session ZTBT recycle-user-center/authorize/get/product-line-token/by/login-token json=${token1}
${gettoken} Get From Dictionary ${reps.json()["data"]} token #获取token
${userId} Get From Dictionary ${reps.json()["data"]} userId #获取用户id
log ${reps.json()["data"]["token"]}
Set Global Variable ${gettoken}
Set Global Variable ${userId}

12
4-Data-comparison/1-Formula-calculation.robot

@ -1,12 +0,0 @@
*** Settings ***
Library RequestsLibrary
Library Collections
*** Test Cases ***
Formula_calculation
#公式计算
${结算单价}= Evaluate ${unitPrice}+${publicSubsidies}
${扣点(%)}= Evaluate (${netWeight}-${settleWeight})/${netWeight}
${代卖费(元)}= Set Variable If '${proxySellerSettleType}'=='1' ${unitSurcharge}*${netWeight} ${unitSurcharge}*${settleWeight}
${第一笔应付金额(元)}= Set Variable If '${activitySettleType}'=='null'
'${activitySettleType}'=='2'

12
DemoApp/APP_login.robot

@ -1,12 +0,0 @@
*** Settings ***
Suite Setup OpenApp
Library AppiumLibrary
Resource Keyword.txt
Library urllib3
*** Test Cases ***
login
Wait Until Element Is Visible com.qniao.cloudprint:id/tabs 10 #进入首页等待10S
Click Element name=我的 #点击-我的
Click Element name=点击登录 #点击-点击登录
Click Button //button[@class='wux-button wux-button--positive wux-button--default wux-button--block wux-button--bordered'] #点击-同意

6
DemoApp/Keyword.txt

@ -1,6 +0,0 @@
*** Settings ***
Library AppiumLibrary
*** Keywords ***
OpenApp
Open Application http://localhost:4723/wd/hub/session platformName=Android platformVersion=5.1.1 deviceName=127.0.0.1:5555 app=E:/lyl/Order/Order/DemoApp/app-release.apk appPackage=com.qniao.cloudprint appActivity=com.qniao.cloudprint.MainActivity unicodeKeyboard=True resetKeyboard=True

0
DemoApp/__init__.robot

BIN
DemoApp/app-release.apk

0
Resource/__init__.robot

35
Resource/关键字.txt

@ -1,35 +0,0 @@
*** Settings ***
Library urllib3
Library Collections
Library RequestsLibrary
*** Variables ***
${header} {'content-type':'application/json','X-APP-ID':'470236309865238528'}
${url} http://api-client-ztb-test.qniao.cn
*** Keywords ***
userlogin
#验证码登录
Disable Warnings
Create Session ZTBT https://api-client-uec-test.qniao.cn ${header}
${data} Create Dictionary account=15014242835 captcha=888888 accountType=2
#${data} Set Variable {"accountType":2,"password":null,"account":"13168550964","captcha":"${text_code}"}
${respones} POST On Session ZTBT uec/authorize/by-captcha json=${data}
log ${respones.status_code}
log ${respones.json()}
${token} Get From Dictionary ${respones.json()["data"]} token
Set Global Variable ${token}
[Teardown]
[Return] ${token}
login-token
#${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528
Create Session ZTBT ${url} ${header}
${token1} Create Dictionary loginToken=${token}
${reps} Post On Session ZTBT recycle-user-center/authorize/get/product-line-token/by/login-token json=${token1}
${gettoken} Get From Dictionary ${reps.json()["data"]} token #获取token
${userId} Get From Dictionary ${reps.json()["data"]} userId #获取用户id
log ${reps.json()["data"]["token"]}
Set Global Variable ${gettoken}
Set Global Variable ${userId}
[Return] ${gettoken}

25
Resource/关键字使用.robot

@ -1,25 +0,0 @@
*** Settings ***
Suite Setup Run Keywords userlogin
... AND 关键字.Login-token
Resource 关键字.txt
Library urllib3
Library Collections
Library RequestsLibrary
*** Variables ***
${url} https://api-client-ztb-test.qniao.cn
*** Test Cases ***
get_paper-mill-city
#获取纸厂所在城市
userlogin
${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=QNT ${gettoken}
Create Session ZTBT ${url} ${header}
${reps} Get On Session ZTBT recycle-service/get/paper-mill-city
${data} Get From Dictionary ${reps.json()} data #城市列表
FOR ${items} IN @{data}
${cityName} Get From Dictionary ${items} cityName #城市name
${cityId} Get From Dictionary ${items} cityId #城市id
Exit For Loop If '${cityName}'=='荆州市'
END
Set Global Variable ${cityId}

657
pabot_results/0/output.xml
File diff suppressed because it is too large
View File

2
pabot_results/0/robot_stderr.out

@ -1,2 +0,0 @@
[ ERROR ] RuntimeError catched in remotelib keyword execution. Maybe there is no connection - is pabot called with --pabotlib option? ErrorDetails: RuntimeError('Connection to remote server broken: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',)
pabot.PabotLib#_close: threw an exception: is --pabotlib flag used? ErrorDetails: RuntimeError('Connection to remote server broken: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',)

18
pabot_results/0/robot_stdout.out

@ -1,18 +0,0 @@
==============================================================================
3-Pabotdemo
==============================================================================
3-Pabotdemo.1-Get List
==============================================================================
a | PASS |
------------------------------------------------------------------------------
get-factorylist
value: {'categoryId': '630378353517531136', 'categoryName': 'ºÚ¿¨', 'yesterdayUnitPrice': None, 'unitPrice': 1.23, 'floatingPrice': 0.01, 'publicSubsidies': None}
| PASS |
------------------------------------------------------------------------------
3-Pabotdemo.1-Get List | PASS |
2 tests, 2 passed, 0 failed
==============================================================================
3-Pabotdemo | PASS |
2 tests, 2 passed, 0 failed
==============================================================================
Output: E:\lyl\Order\Order\pabot_results\0\output.xml

52
pabotdemo/添加银行卡.robot

@ -1,52 +0,0 @@
*** Settings ***
Documentation 添加银行卡
Library RequestsLibrary
Library Collections
Resource 登录关键字.txt
Library pabot.pabotlib
*** Variables ***
*** Test Cases ***
a
userlogin {"accountType":2,"password":null,"account":"15014242835","captcha":"888888"}
login-token ${token}
getuserinfo
getBankCardList
#获取银行卡列表
${headers} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${token}
Create Session ZTBT http://api-client-psc-test.qniao.cn ${headers}
${reps} Get On Session ZTBT payment-settlement-center/bankcard/getBankCardList
log ${reps.json()}
bankcard_home
#获取银行卡信息
${headers} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${token}
Create Session ZTBT http://api-client-psc-test.qniao.cn ${headers}
${reps} Get On Session ZTBT payment-settlement-center/bankcard/bankcard/home/6212263602133910992
log ${reps.json()}
${cardNo} Get From Dictionary ${reps.json()["data"]} cardNo #获取银行卡号
${bankName} Get From Dictionary ${reps.json()["data"]} bankName #获取银行名称
${bank} Get From Dictionary ${reps.json()["data"]} bank #银行名称
${cardType} Get From Dictionary ${reps.json()["data"]} cardType #银行卡类型
Set Global Variable ${cardNo}
Set Global Variable ${bankName}
Set Global Variable ${bank}
Set Global Variable ${cardType}
bankverify
#添加银行卡
${headers} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${token}
Create Session ZTBT http://api-client-psc-test.qniao.cn ${headers}
${data} Set Variable {"phone":null,"cardName":null,"cardNo":"${cardNo}","openingBank":null,"cardType":null,"idno":null,"name":"${realName}","verificationCode":null,"isExist":0,"type":2}
${repsponse} Post On Session ZTBT payment-settlement-center/bankcard/post/verify/bankverify ${data.encode('utf-8')}
log ${repsponse.json()}
post_bankverify
#提交银行卡验证
${headers} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${token}
Create Session ZTBT http://api-client-psc-test.qniao.cn ${headers}
${data} Set Variable {"phone":"15014242835","cardName":"${bank}","cardNo":"${cardNo}","openingBank":null,"cardType":"${cardType}","idno":null,"name":"${realName}","verificationCode":"888888","isExist":0,"type":4}
${reps} Post On Session ZTBT payment-settlement-center/bankcard/post/verify/bankverify ${data.encode('utf-8')}
log ${reps.json()}

46
pabotdemo/登录关键字.txt

@ -1,46 +0,0 @@
*** Settings ***
Library RequestsLibrary
Library Collections
Library urllib3
Library DatabaseLibrary
*** Variables ***
${url} http://api-client-ztb-test.qniao.cn
*** Keywords ***
userlogin
[Arguments] ${data}
#验证码登录
Disable Warnings
${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528
Create Session ZTBT https://api-client-uec-test.qniao.cn ${header}
${data} Create Dictionary account=15014242835 captcha=888888 accountType=2
#${data} Set Variable {"accountType":2,"password":null,"account":"15014242835","captcha":"${text_code}"}
${respones} POST On Session ZTBT uec/authorize/by-captcha json=${data}
log ${respones.status_code}
log ${respones.json()}
${token} Get From Dictionary ${respones.json()["data"]} token
Set Global Variable ${token}
[Teardown]
login-token
[Arguments] ${token}
${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528
Create Session ZTBT ${url} ${header}
${token1} Create Dictionary loginToken=${token}
${reps} Post On Session ZTBT recycle-user-center/authorize/get/product-line-token/by/login-token json=${token1}
${gettoken} Get From Dictionary ${reps.json()["data"]} token #获取token
${userId} Get From Dictionary ${reps.json()["data"]} userId #获取用户id
log ${reps.json()["data"]["token"]}
Set Global Variable ${gettoken}
Set Global Variable ${userId}
getuserinfo
#获取用户信息
${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${gettoken}
Create Session baseinfo ${url} ${header}
${reps} Get On Session baseinfo recycle-service/user/get/base-info
${realName} Get From Dictionary ${reps.json()["data"]} realName #获取实名
${userId} Get From Dictionary ${reps.json()["data"]} userId #获取用户id
Set Global Variable ${realName}
Set Global Variable ${userId}
Loading…
Cancel
Save