1.安装python:https://www.python.org/
2.安装python的第三方库:robotframework
(1)检查是否支持pip命令.
(2)robotframework安装命令:pip install robotframework安装命令
3.安装Eclipse和期RED插件
(1)安装jdk1.8 64位及以上
(2)eclipse版本有要求,并且要和RED插件匹配.
(3)RED插件的安装;http://robotframework.org/#tools
RED Eclipse based editor with a debugger by Nokia.
Requirements(RED_feature_0.8.9.201811201308.zip)
- Oracle Java 1.8+ https://www.java.com/
- RED feature only: Eclipse Oxygen (v 4.7), preferably IDE for Java Developershttps://www.eclipse.org/downloads/
- Python/Jython & RobotFramework installed
4.Eclipse配置
(1)配置RobotFramework离线安装:Help=>Install New Software=>add=>name:robotframework,Location:选择下载好的压缩文件,勾选直接Next到finish,重启Eclipse!
(2)配置本地python安装地址
(3)配置关键字自动提示:
(4)配置编码格式UTF-8
5.创建RobotFramework工程
6.插入代码:
*** Test Cases ***
用例1-使用robot日志功能打印RobotFramework!
Log hello RobotFramework! 用例2-使用robot断言
Should Be Equal As Integers 100 200
7.执行输出
Command: D:\Python3.6.5\python.exe -m robot.run --listener C:\Users\ADMINI~1\AppData\Local\Temp\RobotTempDir7765335777835481610\TestRunnerAgent.py:51116 --argumentfile C:\Users\ADMINI~1\AppData\Local\Temp\RobotTempDir7765335777835481610\args_e64a91fd.arg D:\eclipse-workspace\robot_Demo1
Suite Executor: Robot Framework 3.0.4 (Python 3.6.5 on win32)
==============================================================================
robot Demo1
==============================================================================
robot Demo1.测试用例
==============================================================================
用例1-使用robot日志功能打印RobotFramework! | PASS |
------------------------------------------------------------------------------
用例2-使用robot断言 | FAIL |
100 != 200
------------------------------------------------------------------------------
robot Demo1.测试用例 | FAIL |
2 critical tests, 1 passed, 1 failed
2 tests total, 1 passed, 1 failed
==============================================================================
robot Demo1 | FAIL |
2 critical tests, 1 passed, 1 failed
2 tests total, 1 passed, 1 failed
==============================================================================
Output: D:\eclipse-workspace\robot_Demo1\output.xml
Log: D:\eclipse-workspace\robot_Demo1\log.html
Report: D:\eclipse-workspace\robot_Demo1\report.html
8.查看测试报告
9.插看执行用例log
10.小结:通过学习后总结,亲手实践,分享给正在学习robotFramework的小白!