robot使用帮助

Robot Framework --一个通用的自动化测试框架
Version:  3.0 (Python 2.7.5 on linux2)


使用:  robot [options] data_sources
   or:  python -m robot [options] data_sources
   or:  python path/to/robot [options] data_sources
   or:  java -jar robotframework.jar [options] data_sources


Robot Framework is a Python-based keyword-driven test automation framework foracceptance level testing and acceptance test-driven development (ATDD)..她使用很易于使用的表格语法来创建测试用例并且能使用Python或Java来扩展测试库。使用者也可以通过现有的关键字使用与创建测试用例相同的语法来创建更高级的keywords。


执行侧首最简单的方法就是正常安装以后使用“robot”脚本创建。或者通过 `python -m robot`直接执行’robot‘模块,这里的python可以是任何python解释器,比如`jython`、`ipy` 、 `python3`.还可以采用`python path/to/robot`的方式来运行robot文件夹。Finally, there is a standalone JAR distribution


Data sources given to Robot Framework are either test case files or directories containing them and/or other directories. Single test case file creates a test suite containing all the test cases in it and a directory containing test case files creates a higher level test suite with test case files or other directories as sub test suites. If multiple data sources are given, a virtual top level suite containing suites generated from given data sources is created.


By default Robot Framework creates an XML output file and a log and a report in HTML format, but this can be configured using various options listed below. Outputs in HTML format are for human consumption and XML output for integration with other systems. XML outputs can also be combined and otherwise further processed with `rebot` tool. Run `rebot --help` for more information.


Robot Framework is open source software released under Apache License 2.0. Its
copyrights are owned and development supported by Nokia Solutions and Networks.
For more information about the framework see http://robotframework.org/.


Options
=======


-N --name name           
Set the name of the top level test suite. Underscores in the name are converted to spaces. Default name is created from the name of the executed data source.
设置最高级的suite的名字。名字中的下划线将转换为空格。默认名字是根据要执行的数据库来创建的。
-D --doc documentation   
Set the documentation of the top level test suite. Underscores in the documentation are converted to spaces and it may also contain simple HTML formatting e.g. *bold* and http://url/).
设置最高级test suite的文档。文档中的下划线将转换为空格并且可能包含简单的HTML格式,例如:*bold* 和 http://url/
-M --metadata name:value * 
 Set metadata of the top level suite. Underscores in the name and value are converted to spaces. Value can contain same HTML formatting as --doc. Example: --metadata version:1.2 
设置最高级suite的元数据。名字和值中下划线将转换为空格。Value可以包含与’--doc‘相同的HTML格式,示例:--metadata version:1.2
-G --settag tag *        
Sets given tag(s) to all executed test cases.
给所有执行的测试用例设置tag(s)
-t --test name *         
Select test cases to run by name or long name. Name is case and space insensitive and it can also be a simple pattern where `*` matches anything and `?` matches any char. If using `*` and `?` in the console is problematic see --escape and --argumentfile.
通过name或long name来选择需要运行的测试用例。name就是case、对空格不敏感,并且能用“*”简单匹配所有,用“?”匹配任何字符。如果在控制台使用“*”、“?”是有问题的,查看 --escape 和 --argumentfile
-s --suite name *        
Select test suites to run by name. When this option is used with --test, --include or --exclude, only test cases in matching suites and also matching other filtering criteria are selected. Name can be a simple pattern similarly as with --test and it can contain parent name separated with a dot.
 For example `-s X.Y` selects suite `Y` only if its parent is `X`.
通过name来选择需要运行的test suite。当这个参数用于--test, --include 或 --exclude,只有同时满足suites和其他过滤条件的时候才会选择。name能使用和--test一样的简单匹配模式,name还能使用使用“.”分割的方式包含parent name。
示例:`-s X.Y`选择parent为X的suite Y。
-i --include tag *       
Select test cases to run by tag. Similarly as name with --test, tag is case and space insensitive and it is possible to use patterns with `*` and `?` as wildcards. Tags and patterns can also be combined together with `AND`, `OR`, and `NOT` operators. 
Examples: --include foo --include bar* 
                --include fooANDbar*
通过tag来选择要运行的test cases。与--test类似,tag就是case、对空格不敏感,并且能用“*”简单匹配所有,用“?”匹配任何字符。Tags并匹配模式能与`AND`, `OR`, and `NOT` 来组合操作。
示例:--include foo --include bar* 
         --include fooANDbar*
-e --exclude tag *       
Select test cases not to run by tag. These tests are not run even if included with --include. Tags are matched using the rules explained with --include.
使用tag来选择哪些test case不需要运行。即使在--include中包含了,这些test case也不会运行。Tags的匹配规则和 --include一样
-R --rerunfailed output  
Select failed tests from an earlier output file to be re-executed. Equivalent to selecting same tests individually using --test option.
从最近运行的output文件中选择失败的case再次运行。与单独使用 --test参数选择相同的case等效。
-c --critical tag *      
Tests having given tag are considered critical. If no critical tags are set, all tags are critical. Tags can be given as a pattern like with --include.
有给定tag被认为是critical的测试。如果没有设置critical 标签,那么所有的标签都是critical。像 --include一样的pattern能作为标签。
-n --noncritical tag *   
Tests with given tag are not critical even if they have a tag set with --critical. Tag can be a pattern.


-v --variable name:value *  
Set variables in the test data. Only scalar variables with string value are supported and name is given without `${}`. See --escape for how to use special characters and --variablefile for a more powerful variable setting mechanism.
Examples:
--variable str:Hello       =>  ${str} = `Hello`
-v hi:Hi_World -E space:_  =>  ${hi} = `Hi World`
-v x: -v y:42              =>  ${x} = ``, ${y} = `42`
在测试数据中设置变量。只支持String类型的scalar变量,并且名字不需要用`${}`给出。看 --escape了解如何使用特殊字符,看--variablefile了解强大的变量设置机制。
示例:--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 *  
Python or YAML file file to read variables from. Possible arguments to the variable file can be given after the path using colon or semicolon as separator.
Examples: --variablefile path/vars.yaml
--variablefile environment.py:testing
Python或YAML文件从文件中读取变量。可能的参数变量文件路径后可以使用冒号或分号作为分隔符。
示例:--variablefile path/vars.yaml
--variablefile environment.py:testing
-d --outputdir dir       
Where to create output files. The default is the directory where tests are run from and the given path is considered relative to that unless it is absolute.
创建输出文件。
-o --output file         
XML output file. Given path, similarly as paths given to --log, --report, --xunit, and --debugfile, is relative to --outputdir unless given as an absolute path. Other output files are created based on XML output files after the test execution and XML outputs can also be further processed with Rebot tool. Can be disabled by giving a special value `NONE`. In this case, also log and report are automatically disabled.
Default: output.xml
XML输出文件。像--log, --report, --xunit, and --debugfile给出的路径方式一样,他相对于--outputdir的路径除非给出的是绝对路径。在测试执行后,其他的输出文件是基于XML输出文件来创建的。XML输出还能使用Robot工具来被进一步处理。还能通过给定特殊值“NONE”来禁用。如果这样,log和repot也会自动禁用。
-l --log file            
HTML log file. Can be disabled by giving a special value `NONE`. Default: log.html
Examples: `--log mylog.html`, `-l NONE`
HTML日志文件。能使用特殊值“NONE”来禁用。
-r --report file         
HTML report file. Can be disabled with `NONE` similarly as --log. Default: report.html
HTML report文件。像 --log一样能使用特殊字符“NONE”来禁用。
-x --xunit file          
xUnit compatible result file. Not created unless this option is specified.
--xunitskipnoncritical  Mark non-critical tests on xUnit output as skipped.
xUnit兼容的结果文件。如果不指定则不创建。
--xunitskipnoncritical ,在xUnit输出中标记non-critical来跳过。
-b --debugfile file      
Debug file written during execution. Not created unless this option is specified.
执行时的Debug文件。若不指定则不创建。
-T --timestampoutputs    
When this option is used, timestamp in a format `YYYYMMDD-hhmmss` is added to all generated output files between their basename and extension.
 For example: `-T -o output.xml -r report.html -l none` creates files like `output-20070503-154410.xml` and `report-20070503-154410.html`.
使用这个参数时, `YYYYMMDD-hhmmss`格式的时间戳将添加到所有生成的output文件的基本名字和执行内容之间。示例:
    --splitlog            
Split log file into smaller pieces that open in browser transparently.
拆分日志文件
    --logtitle title      
Title for the generated test log. The default title is `<Name Of The Suite> Test Log`. Underscores in the title are converted into spaces in all titles.
生成测试日志的标题。默认title为 `<Name Of The Suite> Test Log`.所有的title中的下划线就转换为空格。
    --reporttitle title   
Title for the generated test report. The default title is `<Name Of The Suite> Test Report`.
生成的测试报告的标题。默认显示为`<Name Of The Suite> Test Report`
    --reportbackground colors  
Background colors to use in the report file. Either `all_passed:critical_passed:failed` or `passed:failed`. Both color names and codes work.
Examples: --reportbackground green:yellow:red
--reportbackground #00E:#E00
报告文件中的背景颜色。要么是`all_passed:critical_passed:failed`要么是 `passed:failed`。支持名称颜色和颜色代码。
-L --loglevel level      
Threshold level for logging. Available levels: TRACE,  DEBUG, INFO (default), WARN, NONE (no logging). Use syntax `LOGLEVEL:DEFAULT` to define the default visible log level in log files.
Examples: --loglevel DEBUG
--loglevel DEBUG:INFO
Threshold等级的记录日志。允许的等级:TRACE,  DEBUG, INFO (default), WARN, NONE (no logging).使用语法`LOGLEVEL:DEFAULT`来定义日志文件中默认可见的日志等级。
    --suitestatlevel level  
How many levels to show in `Statistics by Suite` in log and report. By default all suite levels are shown. 
Example:  --suitestatlevel 3
在log和report中显示多少个`Statistics by Suite`。默认所有的等级都显示。
    --tagstatinclude tag *  
Include only matching tags in `Statistics by Tag` and `Test Details` in log and report. By default all tags set in test cases are shown. Given `tag` can also be a simple pattern (see e.g. --test).
在日志和报告中仅包含在`Statistics by Tag` 和 `Test Details`中匹配的标签。默认测试用例中所有的标签都显示。给出的“tag”能使用简单匹配模式,参见 --test
    --tagstatexclude tag *  
Exclude matching tags from `Statistics by Tag` and `Test Details`. This option can be used with --tagstatinclude similarly as --exclude is used with --include.
执行在`Statistics by Tag` 和 `Test Details`中匹配的标签。这个参数可以用在--tagstatinclude,就像--exclude用在 --include一样。
    --tagstatcombine tags:name *  
Create combined statistics based on tags. These statistics are added into `Statistics by Tag` and matching tests into `Test Details`. If optional `name` is not given, name of the combined tag is got  from the specified tags. Tags are combined using the rules explained in --include.
Examples: --tagstatcombine requirement-*
               --tagstatcombine tag1ANDtag2:My_name
基于标签创建结合数据。这些数据添加到 `Statistics by Tag`并且到 `Test Details`.匹配测试。如果参数name没有给出,结合标签的名称回车特殊标签中获取。Tags结合使用规则可参考 --include。
    --tagdoc pattern:doc *  
Add documentation to tags matching given pattern. Documentation is shown in `Test Details` and also as a tooltip in `Statistics by Tag`. Pattern can contain characters `*` (matches anything) and `?` (matches any char). Documentation can contain formatting similarly as with --doc option.
Examples: --tagdoc mytag:My_documentation
               --tagdoc regression:*See*_http://info.html
               --tagdoc owner-*:Original_author
添加文档来匹配给定模式的标签。文件在 `Test Details` 中显示,并作为`Statistics by Tag`的工具提示。模式能包含“*”、“?”。文档能包含的格式与参数--doc类似。
    --tagstatlink pattern:link:title *  
Add external links into `Statistics by Tag`. Pattern can contain characters `*` (matches anything) and `?` (matches any char). Characters matching to wildcard expressions can be used in link and title with syntax %N, where N is index of the match (starting from 1). In title underscores are automatically converted to spaces.
 Examples: --tagstatlink mytag:http://my.domain:Link
               --tagstatlink bug-*:http://tracker/id=%1:Bug_Tracker
添加其他的link到`Statistics by Tag`。匹配模式可使用“*”、“?”。字符匹配通配符表达式采用语法“%N”能用于link和title,N是匹配的索引,从1开始。在标题中下划线自动转换为空格
    --removekeywords all|passed|for|wuks|name:<pattern>|tag:<pattern> *
Remove keyword data from the generated log file. Keywords containing warnings are not removed except  in `all` mode.
all:     remove data from all keywords 
passed:  remove data only from keywords in passed test cases and suites
for:     remove passed iterations from for loops
wuks:    remove all but the last failing keyword  inside `BuiltIn.Wait Until Keyword Succeeds`
name:<pattern>:  remove data from keywords that match the given pattern. The pattern is matched against the full name of the keyword(e.g. 'MyLib.Keyword', 'resource.Second Keyword'), is case, space, and underscore insensitive,and may contain `*` and `?` as wildcards.
Examples: --removekeywords name:Lib.HugeKw
              --removekeywords name:myresource.*
 tag:<pattern>:  remove data from keywords that match the given pattern. Tags are case and space insensitive and it is possible to use patterns with `*` and `?` as wildcards.Tags and patterns can also be combined  together with `AND`, `OR`, and `NOT`  operators.
Examples: --removekeywords foo
              --removekeywords fooANDbar*
从生成的日志文件中删除keyword的数据。在非“all”模式下,有警告的keywords不会删除。
all: 删除所有keywords
passed:从testcase和suite的所有keywords中删除成功的。
for:从for循环中删除成功的迭代
wuks:删除所有除了`BuiltIn.Wait Until Keyword Succeeds`中的最近失败的keywords。
name:<pattern>: 从匹配给定模式的keywords中删除数据。模式匹配keyword的全名(例如,'MyLib.Keyword', 'resource.Second Keyword'),模式是case、space并且下划线不敏感还可以包含“*”、“?”通配符。


    --flattenkeywords for|foritem|name:<pattern>|tag:<pattern> *
Flattens matching keywords in the generated log file. Matching keywords get all log messages from their child keywords and children are discarded otherwise.
for:     flatten for loops fully
foritem: flatten individual for loop iterations
name:<pattern>:  flatten matched keywords using same matching rules as with `--removekeywords name:<pattern>`
tag:<pattern>:  flatten matched keywords using same matching rules as with`--removekeywords tag:<pattern>`
在日志文件中趋于平缓匹配keywords。匹配的keywords从他们的子keywords中获取长信息,而子keywords被丢弃。
    --listener class *    
A class for monitoring test execution. Gets notifications e.g. when a test case starts and ends. Arguments to the listener class can be given after the name using colon or semicolon as a separator.
Examples: --listener MyListenerClass
              --listener path/to/Listener.py:arg1:arg2
监控测试执行的类。当测试开始和结束的时候获取通知。参数可以在name后使用冒号或封号隔开。
    --warnonskippedfiles  
If this option is used, skipped test data files will cause a warning that is visible in the console output and the log file. By default skipped files only cause an info level syslog message.
如果使用这个参数跳过的测试数据文件将在控制台和日志文件中导致一个警告。默认跳过的文件则只会产生一个info等级的syslog message。
    --nostatusrc          
Sets the return code to zero regardless of failures in test cases. Error codes are returned normally.
设置返回0,不管test case中的失败。错误code则正常返回。
    --runemptysuite       
Executes tests also if the top level test suite is empty. Useful e.g. with --include/--exclude when it  is not an error that no test matches the condition.
执行测试即使最高级的test suite是空的。
    --dryrun              
Verifies test data and runs tests so that library  keywords are not executed.
验证测试数据和运行测试,以便让Library的keywords不执行。
    --exitonfailure       
Stops test execution if any critical test fails.
如果有critical的测试失败则停止执行测试。
    --exitonerror         
Stops test execution if any error occurs when parsing test data, importing libraries, and so on.
当解析测试数据,导入Library等,有任何错误,则停止执行测试
    --skipteardownonexit  
Causes teardowns to be skipped if test execution is stopped prematurely.
如果提前停止执行测试,会导致teardown被跳过。
    --randomize all|suites|tests|none  
Randomizes the test execution order.
all:    randomizes both suites and tests
suites: randomizes suites
 tests:  randomizes tests
none:   no randomization (default)
Use syntax `VALUE:SEED` to give a custom random seed.
The seed must be an integer.
Examples: --randomize all
--randomize tests:1234
随机执行测试。
    --prerunmodifier class *  
Class to programmatically modify the test suite structure before execution.
用于在执行前以编程的方式修改test suite结构的类。
    --prerebotmodifier class *  
Class to programmatically modify the result model before creating reports and logs.
用于在创建报告和日志之前以编程的方式修改类。
    --console type        
How to report execution on the console.
verbose:  report every suite and test (default)
dotted:   only show `.` for passed test, `f` for failed non-critical tests, and `F` for failed critical tests
quiet:    no output except for errors and warnings
none:     no output whatsoever
在控制台中如何报告执行
-. --dotted              
Shortcut for `--console dotted`.
    --quiet               
Shortcut for `--console quiet`.
-W --consolewidth chars  
Width of the monitor output. Default is 78.
监视器输出的长度,默认78.
-C --consolecolors auto|on|ansi|off  
Use colors on console output or not.
auto: use colors when output not redirected (default)
on:   always use colors
ansi: like `on` but use ANSI colors also on Windows
off:  disable colors altogether
Note that colors do not work with Jython on Windows.
是否在控制台输出中使用颜色
-K --consolemarkers auto|on|off  
Show markers on the console when top level keywords in a test case end. Values have same semantics as with --consolecolors.
-P --pythonpath path *   
Additional locations (directories, ZIPs, JARs) where to search test libraries and other extensions when they are imported. Multiple paths can be given by separating them with a colon (`:`) or by using this option several times. Given path can also be a glob pattern matching multiple paths but then it normally must be escaped or quoted.
Examples:
--pythonpath libs/
 --pythonpath /opt/testlibs:mylibs.zip:yourlibs
-E star:STAR -P lib/STAR.jar -P mylib.jar
用于搜寻测试库和其他扩展导入的附加路径(directories, ZIPs, JARs)。通过冒号‘:’分离或者重复使用该参数的方式能添加许多路径。给定的路径也可以是glob模式匹配的多个路径,但是通常必须转义或引用
-E --escape what:with *  
Escape characters which are problematic in console. `what` is the name of the character to escape and `with` is the string to escape it with. Note that all given arguments, incl. data sources, are escaped so escape characters ought to be selected carefully.Available escapes: amp (&), apos ('), at (@), bslash (\), colon (:), comma (,), curly1 ({), curly2 (}), dollar ($), exclam (!), gt (>), hash (#), lt (<), paren1 ((), paren2 ()), percent (%), pipe (|), quest (?), quot ("), semic (;), slash (/), space ( ), square1 ([), square2 (]), star (*)
 Examples:
      --escape space:_ --metadata X:Value_with_spaces
      -E space:SP -E quot:Q -v var:QhelloSPworldQ
在控制台中的转义字符的问题。‘what’是要转移的字符,‘with’是要转义的字符。注意,所有给定的参数,incl,数据源都是转义过的,所以转义字符应该谨慎使用。可以的转义字符:
-A --argumentfile path *  
Text file to read more arguments from. Use special path `STDIN` to read contents from the standard input stream. File can have both options and data sources  one per line. Contents do not need to be escaped but spaces in the beginning and end of lines are removed. Empty lines and lines starting with a hash character (#) are ignored.
Example file:
      |  --include regression
      |  --name Regression Tests
      |  # This is a comment line
      |  my_tests.html
      |  path/to/test/directory/
Examples:
      --argumentfile argfile.txt --argumentfile STDIN
用于读取更多参数的文本文件。使用特殊路径`STDIN`来从标准输入流读取内容。
-h -? --help             
Print usage instructions.
--version                
Print version information.


Options that are marked with an asterisk (*) can be specified multiple times.
For example, `--test first --test third` selects test cases with name `first`
and `third`. If an option accepts a value but is not marked with an asterisk,
the last given value has precedence. For example, `--log A.html --log B.html`
creates log file `B.html`. Options accepting no values can be disabled by
using the same option again with `no` prefix added or dropped. The last option
has precedence regardless of how many times options are used. For example,
`--dryrun --dryrun --nodryrun --nostatusrc --statusrc` would not activate the
dry-run mode and would return normal status rc.


Long option format is case-insensitive. For example, --SuiteStatLevel is
equivalent to but easier to read than --suitestatlevel. Long options can
also be shortened as long as they are unique. For example, `--logti Title`
works while `--lo log.html` does not because the former matches only --logtitle
but the latter matches --log, --loglevel and --logtitle.


Environment Variables
=====================


ROBOT_OPTIONS             Space separated list of default options to be placed
                          in front of any explicit options on the command line.
ROBOT_SYSLOG_FILE         Path to a file where Robot Framework writes internal
                          information about parsing test case files and running
                          tests. Can be useful when debugging problems. If not
                          set, or set to a special value `NONE`, writing to the
                          syslog file is disabled.
ROBOT_SYSLOG_LEVEL        Log level to use when writing to the syslog file.
                          Available levels are the same as with --loglevel
                          command line option and the default is INFO.
ROBOT_INTERNAL_TRACES     When set to any non-empty value, Robot Framework's
                          internal methods are included in error tracebacks.


Examples
========


# Simple test run with `robot` without options.
$ robot tests.robot


# Using options.
$ robot --include smoke --name Smoke_Tests path/to/tests.robot


# Executing `robot` module using Python.
$ python -m robot test_directory


# Running `robot` directory with Jython.
$ jython /opt/robot tests.robot


# Executing multiple test case files and using case-insensitive long options.
$ robot --SuiteStatLevel 2 --Metadata Version:3 tests/*.robot more/tests.robot


# Setting default options and syslog file before running tests.
$ export ROBOT_OPTIONS="--critical regression --suitestatlevel 2"
$ export ROBOT_SYSLOG_FILE=/tmp/syslog.txt
$ robot tests.robot
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值