1.进入RIDE可视化界面。File-->New Project,新建项目

2.层级管理。

3.新建测试包。选中项目,右键点击New Suite

4.新建测试页。右键点击New Suite

5.新建测试用例。

6.pip命令安装python第三方依赖。
allure-pytest 2.6.1
allure-python-commons 2.6.1
aniso8601 8.0.0
Appium-Python-Client 0.26
APScheduler 3.5.1
atomicwrites 1.3.0
attrs 19.1.0
bcrypt 3.1.7
blinker 1.4
certifi 2019.3.9
cffi 1.14.0
chardet 3.0.4
click 7.1.2
colorama 0.4.1
cryptography 2.9.2
decorator 4.4.2
docutils 0.16
enum34 1.1.6
et-xmlfile 1.0.1
Flask 0.11
Flask-APScheduler 1.8.0
Flask-Login 0.2.11
Flask-Mail 0.9.0
Flask-RESTful 0.3.6
Flask-Script 2.0.6
Flask-SSLify 0.1.5
idna 2.8
importlib-metadata 0.17
itsdangerous 1.1.0
jdcal 1.4.1
Jinja2 2.8
kitchen 1.2.6
lxml 4.3.2
MarkupSafe 1.1.1
more-itertools 6.0.0
namedlist 1.7
numpy 1.19.0
openpyxl 3.0.4
paramiko 2.7.1
Pillow 7.1.2
pip 20.1.1
pluggy 0.9.0
py 1.8.0
pycparser 2.20
Pygments 2.6.1
PyMySQL 0.9.3
PyNaCl 1.4.0
Pypubsub 4.0.3
pytest 4.3.1
python-dateutil 2.7.3
pytz 2020.1
pywin32 228
PyYAML 5.3.1
requests 2.21.0
robotframework 3.0.3
robotframework-appiumlibrary 1.4.6
robotframework-databaselibrary 1.0.1
robotframework-requests 0.4.7
robotframework-ride 1.7.4.1
robotframework-seleniumlibrary 3.1.1
robotframework-sshlibrary 3.1.1
selenium 3.141.0
setuptools 39.0.1
six 1.12.0
tzlocal 2.1
urllib3 1.24.1
Werkzeug 0.14.1
wxPython 4.0.7.post2
xlrd 1.2.0
zipp 0.5.1
7.RIDE界面导入依赖包。


8.1新建post请求


*** Settings ***
Library RequestsLibrary
Library Collections
Resource ../login/Keyword.txt
*** Variables ***
${new_product_data} {"appInfoIds":[18],"appPkName":"ws测试","appPkDesc":"测试","isVisible":0,"isQualified":true}
${new_product_path} /consoleapi/console/app-pk
*** Test Cases ***
Class_01
${token} Get_token 管理员
Create Session even ${qa}
${headers} Create Dictionary Content-Type=application/json; charset=UTF-8 token=${token}
${data} To Json ${new_product_data}
${r} Post Request event ${new_product_path} ${data} headers=${headers}
Should Be Equal As Strings ${r.status_code} 200
log ${r.json()}
${dict} Set variable ${r.json()}
log --------断言结果-------
${msg} Get From Dictionary ${dict} message
Should Be Equal ${msg} Success
${sta} Get From Dictionary ${dict} code
${status} Evaluate int(200)
Should Be Equal ${sta} ${status}
8.2新建get请求

*** Settings ***
Library RequestsLibrary
Library Collections
Resource ../login/Keyword.txt
Resource poruct_keys.txt
*** Variables ***
${find_product_data} {"appPackageName":"ws测试产品","pageSize":6,"pageNum":1}
${find_product_path} /consoleapi/console/app-pk
*** Test Cases ***
Class_01
${token} Get_token 锱云管理员
Create Session even ${qa}
${headers} Create Dictionary Content-Type=application/json; charset=UTF-8 token=${token}
${data} To Json ${find_product_data}
${r} Get Request event ${find_product_path} headers=${headers} params=${data}
Should Be Equal As Strings ${r.status_code} 200
log ${r.json()}
${dict} Set variable ${r.json()}
log --------断言结果-------
${msg} Get From Dictionary ${dict} message
Should Be Equal ${msg} Success
${rp_data} Get From Dictionary ${dict} data
${tot} Get From Dictionary ${rp_data} total
${totals} Evaluate int(1)
Should Be Equal ${tot} ${totals}
${sta} Get From Dictionary ${dict} code
${status} Evaluate int(200)
Should Be Equal ${sta} ${status}
9.新建关键字。测试包右键-->New Resource

10.新建自定义变量。测试页-->Add Scalar

11.导入自定义关键字。

12.导入的自定义关键字.txt文件,文件中的自定义变量也可以使用



网友评论