查看版本
pip show 包名
pip show pip ====> 查看pip版本
python -m pip install --upgrade pip ====>升级pip
pip install 包名 ====>安装包
安装robotframework
# Install the latest version
pip install robotframework
# Upgrade to the latest version
pip install --upgrade robotframework
# Install a specific version
pip install robotframework==2.7.1
# Uninstall -- only supported by pip
pip uninstall robotframework
安装robotframwork RIDE
pip install robotframework-ride
好像python3+不支持安装 pip3 install robotframework-ride,我安装的时候出错
虽然报错了,但是我到目录下D:\Program Files (x86)\Python36\Scripts发现已经有ride.py了,然后执行一下python ride.py可以正常打开RIDE
安装其他
pip install -U robotframework-requests
pip install -U requests
pip install robotframework-selenium2library
pip install selenium
pip install wxpython
接口测试案例
创建project(文件夹)->创建test suite(文件夹)->创建testcase
在test suite中引入库名 RequestsLibrary
在testcase中就可以引用这个库的关键字了
RequestsLibrary提供的常用关键字有:https://www.cnblogs.com/zz27zz/p/7347273.html
Create Session
Post Request
Get Request
To Json
常见问题
rf中的日志中文显示乱码的改正方式
修改文件编码 SYSTEM -> OUTPUT,如下
C:\Program Files\Python37\Lib\site-packages\robotide\contrib\testrunner\testrunnerplugin.py
InsecureRequestWarning: Unverified HTTPS request is being made.
解决:
禁用安全请求警告
- 如果
requests >= 2.16.0
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
- 如果
requests < 2.16.0
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)