按测试用例执行
-t --test name *
基于目录
robot -t “testcase_name“ test_directory
基于测试类
robot -t “testcase_name“ path/test_file.robot
多个testcase
robot -t "testcase_name1" -t "testcase_name2" test_directory
按测试类执行
-s --suite name *
robot -s suiteName test_directory
多个suite
robot -s suiteName1 -s suiteName2 test_directory
执行目录下所有用例
robot test_directory
按执行tag执行用例
-i --include tag *
基于目录
robot --include smoke test_directory
基于测试类
robot --include smoke path/test_file.robot多个tag支持逻辑运算符
robot --include tag1ANDtag2 test_directory
robot --include tag1ORtag2 test_directory
剔除用例执行
-e --exclude tag *
robot --exclude smoke test_directory
robot --exclude smoke path/test_file.robot
组合
robot --include a --exclude bANDc test_directory
tag标记
关键的、严重的、紧急的 -c --critical tag *
非紧急的 -n --noncritical tag *
生效于report
robot --include tag1ORtag2 -c tag1 -n tag2 test_directory
变量参数
可以更新多个变量,达到每次跑不一样内容的目的,例如可以通过命令切换环境,切换数据等
robot --variable ENV:uat --variable TEST_DATA:uat regression.robot
结果报告
生成执行报告
默认生成到当前目录,会包含output.xml、log.html、report.html
可以对其分别修改,参数如下:
--outputdir (-d)
--output output.xml
--report report.html
--log log.html不想要某个报告可以设置None,例如:
--output NONE --report NONE --log NONE
合并结果文件
rebot -R new_report.html -o new_output.xml 1st_output.xml 2nd_output.xml
合并目录下所有的结果
python -m robot.rebot --name Combined outputs/*.xml
抽取整合测试结果
rebot --log smoke_log.html --report smoke_report.html --include smoke
--ReportTitle Smoke_Tests --ReportBackground green:yellow:red
--TagStatCombine tag1ANDtag2 path/to/myoutput.xml
资料生成
输出当前框架的lib库或自定义扩展库的说明文档
python -m robot.libdoc OperatingSystem OperatingSystem.html
python -m robot.libdoc RequestsLibrary requestsLibrary.html
python -m robot.libdoc expandAPI.py expandAPI.html
生成用例文档
python -m robot.testdoc dir\testSuite.* testcasedoc.html
仅能生成test case,无法获取user Keyword。