robot 命令参数解析
version > 3.0.1
原文档查看命令:
robot --help
robot -h
-F --extension value
通过文件扩展名控制需要执行的用例。如果只执行一个文件,这个参数无效。需要执行多个扩展名时,用“:”分隔开。
Examples:
--extension robot
-F robot:txt
-N --name name
设置测试套件的名称。如果包含“_”显示为空格。默认值为脚本所在目录的名称。不影响测试的执行过程。
Examples:
--name Regression_Test
-N Smoke
-D --doc documentation
设置整体测试报告的文档。如果包含“_”显示为空格。支持简单的html格式。不影响测试的执行过程。
Examples:
***bold***
http://url/
-M --metadata name:value
设置整体测试报告的数据信息,会显示在测试报告中。不影响测试的执行过程。
Examples:
--metadata version:1.2
--M version:1.2
-G --settag tag *
设置全局标签
Examples:
--settag tag1
--G tag2
-t --test name *
通过测试用名称控制执行范围
Examples:
--test casename1
-t testname2
-s --suite name *
通过测试套件名称控制测试执行范围
Examples:
--suite parentname.childname
-s suitename
-i --include tag *
通过标签控制测试执行范围,可以使用AND, OR, and NOT 操作符
Examples:
--include foo --include bar*
--include fooANDbar*
-e --exclude tag *
通过标签控制测试不执行范围
Examples:
--exclude tag1
-e tag2
-R --rerunfailed output
重新执行一个更早的output文件中的Fail的测试用例
Examples:
--rerunfailed output.xml
-R output.xml
-S --rerunfailedsuites output
重新执行一个更早的output文件中的Fail的Testsuite中的测试用例
Examples:
--rerunfailedsuites output.xml
-S output.xml
-c --critical tag *
设置重要标签的范围
Examples:
--critical tag1
-c tag2
-n --noncritical tag *
设置不重要标签的范围
Examples:
--noncritical tag1
-n tag2
-v --variable name:value *
添加参数
Examples:
--variable str:Hello =>${str} = `Hello`
-v hi:Hi_World -E space:_=>${hi} = `Hi World`
-v x: -v y:42=>${x} = ``, ${y} = `42`
-V --variablefile path *
添加参数文件
Examples:
--variablefile path/vars.yaml
--variablefile environment.py:testing
-d --outputdir dir
测试结果输出文件夹
Examples:
--outputdir result/
-d result/
-o --output file
测试结果数据文件名 Default: output.xml
Examples:
--output output.xml
-o out.xml
-l --log file
测试log文件名,可以通过None值禁用测试日志功能
Examples:
--log mylog.html
-l NONE
-r --report file
测试报告文件名,可以通过None值禁用测试报告功能
Examples:
--report myreport.html
-r NONE
-x --xunit file
兼容xUnit的报告,默认不创建
Examples:
--xunit myxunit1.xml
-x myxunit2.xml
--xunitskipnoncritical
在Xunit报告中标记不重要的测试
-T --timestampoutputs
创建带时间戳的报告文件 output-20070503-154410.xml,report-20070503-154410.html
Examples:
-T -o output.xml -r report.html -l none
--splitlog
把日志文件拆分成很多小的js文件
--logtitle title
设置显示在日志中的名称,“_”转化为空格“ ”
--reporttitle title
设置显示在测试报告中的名称,“_”转化为空格“ ”
--reportbackground colors
设置测试报告背景颜色
Examples:
--reportbackground green:yellow:red
--reportbackground #00E:#E00
-L --loglevel level
设置日志等级,可用的等级有: TRACE,DEBUG, INFO (默认值), WARN, NONE (没有日志).
Examples:
--loglevel DEBUG
--loglevel DEBUG:INFO
--suitestatlevel level
设置显示在测试报告和测试日志中的test suite层数
Examples: --suitestatlevel 3
--tagstatinclude tag *
***在Statistics by Tag中只包含匹配的标签 和“测试详细信息”在日志和报告。 默认 显示全部测试用例中设置的标签。 ***
Examples: --tagstatinclude tag1
--tagstatexclude tag *
***在Statistics by Tag中不包含匹配的标签 和“测试详细信息”在日志和报告。 ***
Examples: --tagstatexclude tag1
--tagstatcombine tags:name *
组合一个标签显示,可以使用--include的操作符
Examples:
--tagstatcombine requirement-*
--tagstatcombine tag1ANDtag2:My_name
--tagdoc pattern:doc *
给标签添加文档说明,可以用表达式匹配标签
Examples:
--tagdoc mytag:My_documentation
--tagdoc regression:*See*_http://info.html
--tagdoc owner-*:Original_author
--tagstatlink pattern:link:title *
添加标签的状态链接和说明,例如添加bug链接
Examples:
--tagstatlink mytag:http://my.domain:Link
--tagstatlink bug-*:http://tracker/id=%1:Bug_Tracker
--removekeywords all|passed|for|wuks|name:|tag: *
在测试日志中移除关键字
all: 删除所有关键字
passed:删除所有passed的测试用例的关键字
for: 删除for循环中的关键字
wuks:(保留原文,没研究出怎么生效)remove all but the last failing keyword inside BuiltIn.Wait Until Keyword Succeeds
name::移除表达式匹配出的关键字
Examples:
--removekeywords name:Lib.HugeKw
--removekeywords name:myresource.*
tag::删除指定测试用例中匹配出的关键字
Examples:
--removekeywords foo
--removekeywords fooANDbar*
--flattenkeywords for|foritem|name:|tag: *
展开关键字
for: 完全展开for循环关键字
foritem: 单独展开for循环的元素
name::展开匹配出的关键字
Examples:
`--removekeywords name:`
tag::展开指定测试用例中匹配出的关键字
Examples:
`--removekeywords tag:`
--listener class *
监听器
Examples:
--listener MyListenerClass
--listener path/to/Listener.py:arg1:arg2
--warnonskippedfiles
配置这个参数后会在控制台和测试日志中显示warning信息,默认值显示info信息
--nostatusrc
测试状态码设置为0,报错的代码会正弦显示
--runemptysuite
及时测试用例集为空也执行测试,不会报没有测试用例的错误
--dryrun
验证测试用例的语法,不会真正执行测试用例
-X --exitonfailure
有任何重要的测试用例Fail的时候,结束测试执行
--exitonerror
有任何语法错误或者引用错误时直接结束测试
--skipteardownonexit
结束测试的时候跳过teardown设置
--randomize all|suites|tests|none
随机执行测试
all:随机全部的 suites 和 tests
suites: 随机 suites
tests:随机 tests
none: 没有随机 (默认)
用语法 VALUE:SEED 可以设置默认的随机种子 SEED必须是整数
Examples:
--randomize all
--randomize tests:1234
--prerunmodifier class *
开始执行测试之前,先用程序编辑一下测试套件结构
--prerebotmodifier class *
在成成测试报告和日志之前,先用程序编辑一下测试结果的模型
--console type
设置控制台输出的方式
verbose:report every suite and test (default)
dotted: pass显示".",重要的fail显示“F”,普通fail显示”f“
quiet:除了errer和warning之外,没有输出
none: 不输出任何信息
-. --dotted
等效于--console dotted
--quiet
等效于--console quiet
-W --consolewidth chars
设置控制台信息的输出宽度,默认值”78“
-C --consolecolors auto|on|ansi|off
设置控制台输出的颜色
auto: 输出不重定向是使用颜色 (默认值)
on: 一直使用颜色
ansi: 适用于Windows
off:关闭颜色显示
注意颜色设置在 Windows 的 Jython中不是生效
-K --consolemarkers auto|on|off
显示顶层关键字标记
-P --pythonpath path *
引用库的路径
Examples:
--pythonpath libs/
--pythonpath /opt/testlibs:mylibs.zip:yourlibs
-E star:STAR -P lib/STAR.jar -P mylib.jar
-E --escape what:with *
转义 可用的转义符: amp (&), apos ('), at (@), bslash (), colon (:), comma (,), curly1 ({), curly2 (}), dollar ($), exclam (!), gt (>), hash (#), lt (
Examples:
--escape space:_ --metadata X:Value_with_spaces
-E space:SP -E quot:Q -v var:QhelloSPworldQ
-A --argumentfile path *
参数文件
Example file:
| --include regression
| --name Regression Tests
| # This is a comment line
| my_tests.robot
| path/to/test/directory/
Examples:
--argumentfile argfile.txt --argumentfile STDIN
-h -? --help
帮助文档
--version
查看当前版本