C:\Users\xxx>robot -h
Robot Framework -- A generic automation framework
Version: 3.1.2 (Python 3.8.0 on win32)
# 常见用法
Usage: 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 generic open source automation framework for acceptance
testing, acceptance test-driven development (ATDD) and robotic process
automation (RPA). It has simple, easy-to-use syntax that utilizes the
keyword-driven automation approach. Keywords adding new capabilities are
implemented in libraries using either Python or Java. New higher level
keywords can also be created using Robot Framework's own syntax.
#Robot框架是一个通用的开源自动化框架
#测试、验收测试驱动开发(ATDD)和机器人过程
#自动化(RPA)。它有简单易用的语法,利用
#关键字驱动的自动化方法。添加新功能的关键字有
#使用Python或Java在库中实现。新的更高层次
#关键字也可以使用Robot框架自己的语法创建
The easiest way to execute Robot Framework is using the `robot` command created
as part of the normal installation. Alternatively it is possible to execute
the `robot` module directly using `python -m robot`, where `python` can be
replaced with any supported Python interpreter such as `jython`, `ipy` or
`python3`. Yet another alternative is running the `robot` directory like
`python path/to/robot`. Finally, there is a standalone JAR distribution
available.
#执行Robot框架的最简单方法是使用创建的“Robot”命令
#作为正常安装的一部分。或者可以执行
#“robot”模块直接使用“python-m robot”,其中“python”可以是
#替换为任何受支持的Python解释器,如“jython”、“ipy”或
#`python3'。另一种选择是运行“robot”目录,比如
#`python路径/to/robot`。最后,还有一个独立的JAR发行版
#可用。
Tests (or tasks in RPA terminology) are created in files typically having the
`*.robot` extension. Files automatically create test (or task) suites and
directories with these files create higher level suites. When Robot Framework
is executed, paths to these files or directories are given to it as arguments.
#测试(或RPA术语中的任务)是在通常具有
#`*.robot'扩展名。文件自动创建测试(或任务)套件和
#包含这些文件的目录创建更高级别的套件。当机器人框架
#执行时,这些文件或目录的路径将作为参数提供给它。
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
post-processed with the Rebot tool that is an integral part of Robot Framework.
Run `rebot --help` for more information.
#默认情况下,Robot框架在
# HTML格式,但可以使用下面列出的各种选项进行配置。
# HTML格式的输出供人使用,XML格式的输出用于集成
#其他系统。XML输出也可以合并,或者进一步
#使用Reboot工具进行后期处理,Reboot工具是Robot框架的组成部分。
#有关详细信息,请运行“reboot--help”。
Robot Framework is open source software released under Apache License 2.0.
For more information about the framework and the rich ecosystem around it
see http://robotframework.org/.
# Robot Framework是在Apache许可证2.0下发布的开源软件。
#有关框架及其周围丰富的生态系统的更多信息
# 见http://robotframework.org/。
Options
# 选项
=======
--rpa Turn on generic automation mode. Mainly affects
terminology so that "test" is replaced with "task"
in logs and reports. By default the mode is got
from test/task header in data files. New in RF 3.1.
#打开通用自动化模式。主要影响
#将“测试”替换为“任务”的术语
#在日志和报告中。默认情况下,模式为
#从数据文件中的测试/任务头。RF 3.1的新功能。
-F --extension value Parse only files with this extension when executing
a directory. Has no effect when running individual
files or when using resource files. If more than one
extension is needed, separate them with a colon.
Examples: `--extension robot`, `-F robot:txt`
New in RF 3.0.1.
#执行时仅分析具有此扩展名的文件
#目录。运行个人时无效
#文件或使用资源文件时。如果不止一个
#需要扩展名,用冒号分隔。
#示例:`--extension robot`,`-F robot:txt`
# RF 3.0.1的新功能。
-N --name name Set the name of the top level test suite. Default
name is created from the name of the executed data
source.
#设置顶级测试套件的名称。违约
#名称是根据执行数据的名称创建的
#来源。
-D --doc documentation Set the documentation of the top level test suite.
Simple formatting is supported (e.g. *bold*). If
the documentation contains spaces, it must be quoted.
Example: --doc "Very *good* example"
#设置顶级测试套件的文档。
#支持简单格式(例如*bold*)。如果
#件包含空格,必须引用。
#示例:-doc“非常*好*示例”
-M --metadata name:value * Set metadata of the top level suite. Value can
contain formatting similarly as --doc.
Example: --metadata version:1.2
-G --settag tag * Sets given tag(s) to all executed test cases.
#将给定的标记设置为所有执行的测试用例。
-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.
#选择要按名称或长名称运行的测试用例。姓名
#不区分大小写和空间,也可以是
#简单模式,其中“*”匹配任何内容和“?`
#匹配任何字符。
--task name * Alias to --test. Especially applicable with --rpa.
#别名为--测试。尤其适用于--rpa。
-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`.
#选择要按名称运行的测试套件。当这个选项
#仅与--test、--include或--exclude一起使用
#在匹配的套件中测试用例,也匹配其他
#已选择筛选条件。名字可以很简单
#模式类似于--test,它可以包含
#父名称用点分隔。例如
#`-s X.Y`仅当其父级为'X'时才选择套件'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*
#选择要按标记运行的测试用例。与名字相似
#使用--test,标记不区分大小写和空间,并且
#可以使用带`*`和`'的模式吗?`作为
#通配符。标签和模式也可以组合在一起
#加上“AND”、“OR”和“NOT”运算符。
#示例:-include foo--include bar*
#--包括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.
#选择不按标记运行的测试用例。这些测试是
#即使包含在--include中也不运行。标签是
#使用用--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.
#从以前的输出文件中选择失败的测试
#重新执行。等同于选择相同的测试
#单独使用--test选项。
-S --rerunfailedsuites output Select failed suite from an earlier output file
to be re-executed. New in RF 3.0.1.
#从以前的输出文件中选择失败的套件
#被重新处决。RF 3.0.1的新功能。
-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.
#给定标记的测试被认为是关键的。如果没有
#设置了关键标记,所有标记都是关键标记。标签
#可以用with-include这样的模式给出。
-n --noncritical tag * Tests with given tag are not critical even if they
have a tag set with --critical. Tag can be a pattern.
#使用给定标记的测试并不重要,即使它们
#用-critical设置一个标记集。标签可以是一种模式。
-v --variable name:value * Set variables in the test data. Only scalar
variables with string value are supported and name is
given without `${}`. See --variablefile for a more
powerful variable setting mechanism.
#在测试数据中设置变量。仅标量
#支持字符串值的变量,名称为
#不带${}给出。有关更多信息,请参见--variablefile
#强大的变量设置机制。
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 * 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.
#从中读取变量的Python或YAML文件。
#可以给出变量文件的可能参数
#在路径后面使用冒号或分号作为分隔符。
Examples: --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和--debugfile,是
#相对于--outputdir,除非指定为绝对值
#路径。其他输出文件是基于XML创建的
#测试执行后的输出文件和XML输出
#也可以使用重新启动工具进一步处理。可以是
#通过指定特殊值“NONE”禁用。在这个
#案例,日志和报告也会自动禁用。
-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报告文件。可以用“无”禁用`类似于--log。
-x --xunit file xUnit compatible result file. Not created unless this
option is specified.
# xUnit兼容的结果文件。不创建,除非已指定选项。
--xunitskipnoncritical Mark non-critical tests on xUnit output as skipped.
# 将xUnit输出上的非关键测试标记为跳过。
-b --debugfile file Debug file written during execution. Not created
unless this option is specified.
#执行期间写入的调试文件。未创建除非指定此选项。
-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 hhmms`添加到所有生成的输出中
#介于其基名称和扩展名之间的文件。为了
#示例`-T-o output.xml-r report.html-l none`
#创建类似“output-20070503-154410.xml”和
#`报表-20070503-154410.html`。
--splitlog Split log file into smaller pieces that open in
browser transparently.
#将日志文件拆分成较小的片段,并在中打开浏览器透明。
--logtitle title Title for the generated test log. The default title
is ` Test Log`.
#生成的测试日志的标题。默认标题
#是“测试日志”。
--reporttitle title Title for the generated test report. The default
title is ` Test Report`.
#生成的测试报告的标题。违约
#标题是“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
#要在报表文件中使用的背景色。
#“所有通过:关键通过:失败”或
#`通过:失败。颜色名称和代码都有效。
--maxerrorlines lines Maximum number of error message lines to show in
report when tests fail. Default is 40, minimum is 10
and `NONE` can be used to show the full message.
#要显示的最大错误消息行数
#测试失败时报告。默认值为40,最小值为10
# “NONE”可用于显示完整消息。
-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
#日志记录的阈值级别。可用级别:跟踪,
#调试、信息(默认)、警告、无(无日志记录)。使用
#语法“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
#按套件统计显示多少级别`
#在日志和报告中。默认情况下,所有套房级别都是展示。
--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).
#在“按标记统计”中仅包含匹配的标记`
#日志和报表中的“测试详细信息”。默认情况下全部
#显示测试用例中设置的标记。给定的“标记”可以
#也可以是一个简单的模式(例如——测试)。
--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”和
#`测试细节。此选项可用于
# --tagstatinclude类似于--exclude与
#--包括。
--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`未给出,得到组合标记的名称
#从指定的标记。使用
#中解释的规则--包括。
--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:Example
--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).
Examples: --tagstatlink mytag:http://my.domain:Title
--tagstatlink "bug-*:http://url/id=%1:Issue Tracker"
#将外部链接添加到`Statistics by
#标签`。模式可以包含字符`*`(匹配项
#什么)和`?`(匹配任何字符)。字符
#匹配通配符表达式可用于链接
#和语法为%N的标题,其中N是#匹配(从1开始)。
--removekeywords all|passed|for|wuks|name:|tag: *
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
#从for循环中移除传递的迭代
wuks: remove all but the last failing keyword
inside `BuiltIn.Wait Until Keyword Succeeds`
#删除除最后一个失败关键字以外的所有关键字
#在“BuiltIn.Wait Until Keyword successful”中`
name:: 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.*
#从匹配的关键字中删除数据
#给定的模式。模式匹配
#根据关键字的全名(例如。
# 'MyLib.Keyword','resource.Second Keyword'),
#不区分大小写、空格和下划线,
#可能包含“*”和“?`作为通配符。
tag:: 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*
#从匹配的关键字中删除数据
#给定的模式。标签是大小写和空格
#不敏感,可以使用带`*`和``的模式?`作为通配符。
#标签和模式也可以组合在一起加上“AND”、“OR”和“NOT”`操作员。
--flattenkeywords for|foritem|name:|tag: *
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:: flatten matched keywords using same
matching rules as with
`--removekeywords name:`
tag:: flatten matched keywords using same
matching rules as with
`--removekeywords tag:`
--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
#用于监视测试执行的类。得到
#通知,例如测试用例开始和结束的时间。
#侦听器类的参数可以在
#使用冒号或分号作为分隔符的名称。
--warnonskippedfiles Deprecated. Nowadays all skipped files are reported.
#已弃用。现在所有跳过的文件都会被报告。
--nostatusrc Sets the return code to zero regardless of failures
in test cases. Error codes are returned normally.
#无论失败与否,都将返回代码设置为零
#在测试用例中。错误代码返回正常。
--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.
#如果顶级测试套件是
#空的。有用的,例如在-include/-exclude时
#不是没有测试与条件匹配的错误。
--dryrun Verifies test data and runs tests so that library
keywords are not executed.
#验证测试数据并运行测试以使库不执行关键字。
-X --exitonfailure Stops test execution if any critical test fails.
Short option -X is new in RF 3.0.1.
#如果任何关键测试失败,则停止测试执行。
#短选项-X是RF 3.0.1中的新选项。
--exitonerror Stops test execution if any error occurs when parsing
test data, importing libraries, and so on.
#如果分析时出现任何错误,则停止测试执行
#测试数据、导入库等。
--skipteardownonexit Causes teardowns to be skipped if test execution is
stopped prematurely.
#如果测试执行过早停止,则导致跳过分解。
--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.
--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.
-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.
Examples:
--pythonpath libs/ --pythonpath resources/*.jar
--pythonpath /opt/testlibs:mylibs.zip:yourlibs
#其他位置(directories, ZIPs, JARs)
#在以下情况下搜索测试库和其他扩展
#它们是进口的。多条路径可以由
#用冒号(`:`)或用这个
#多次选择。给定的路径也可以是全局
#匹配多条路径的模式。
-E --escape what:with * Deprecated. Use console escape mechanism instead.
-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.robot
| 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 using `robot` command 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 path/to/tests
# 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
C:\Users\xxx>