命令行选项

本附录中列出了所有在 执行测试用例_后处理输出_ 时可用的命令行选项. 此外, 可影响执行的环境变量也列了出来.

测试执行相关的命令行选项

-N, —name <name>
Sets the name of the top-level test suite.
-D, —doc <document>
Sets the documentation of the top-level test suite.
-M, —metadata <name:value>
Sets free metadata for the top level test suite.
-G, —settag <tag>
Sets the tag(s) to all executed test cases.
-t, —test <name>
Selects the test cases by name.
-s, —suite <name>
Selects the test suites by name.
-R, —rerunfailed <file>
Selects failed tests from an earlier output file to be re-executed.
—runfailed <file>
Deprecated since Robot Framework 2.8.4. Use —rerunfailed instead.
-i, —include <tag>
Selects the test cases by tag.
-e, —exclude <tag>
Selects the test cases by tag.
-c, —critical <tag>
Tests that have the given tag are considered critical.
-n, —noncritical <tag>
Tests that have the given tag are not critical.
-v, —variable <name:value>
Sets individual variables.
-V, —variablefile <path:args>
Sets variables using variable files.
-d, —outputdir <dir>
Defines where to create output files.
-o, —output <file>
Sets the path to the generated output file.
-l, —log <file>
Sets the path to the generated log file.
-r, —report <file>
Sets the path to the generated report file.
-x, —xunit <file>
Sets the path to the generated xUnit compatible result file.
—xunitskipnoncritical
Mark non-critical tests on xUnit compatible result file as skipped.
-b, —debugfile <file>
A debug file that is written during execution.
-T, —timestampoutputs
Adds a timestamp to all output files.
—splitlog Split log file into smaller pieces that open in browser transparently.
—logtitle <title>
Sets a title for the generated test log.
—reporttitle <title>
Sets a title for the generated test report.
—reportbackground <colors>
Sets background colors of the generated report.
-L, —loglevel <level>
Sets the threshold level for logging. Optionally the default visible log level can be given separated with a colon (:).
—suitestatlevel <level>
Defines how many levels to show in the Statistics by Suite table in outputs.
—tagstatinclude <tag>
Includes only these tags in the Statistics by Tag table.
—tagstatexclude <tag>
Excludes these tags from the Statistics by Tag table.
—tagstatcombine <tags:title>
Creates combined statistics based on tags.
—tagdoc <pattern:doc>
Adds documentation to the specified tags.
—tagstatlink <pattern:link:title>
Adds external links to the Statistics by Tag table.
—removekeywords <all|passed|name:pattern|tag:pattern|for|wuks>
Removes keyword data from the generated log file.
—flattenkeywords <for|foritem|name:pattern|tag:pattern>
Flattens keywords in the generated log file.
—listener <name:args>
Sets a listener for monitoring test execution.
—warnonskippedfiles
Show a warning when an invalid file is skipped.
—nostatusrc Sets the return code to zero regardless of failures in test cases. Error codes are returned normally.
—runemptysuite
Executes tests also if the selected test suites are empty.
—dryrun In the dry run mode tests are run without executing keywords originating from test libraries. Useful for validating test data syntax.
—exitonfailure
Stops test execution &lt;Stopping when first test case fails_&gt; if any critical test fails.
—exitonerror Stops test execution &lt;Stopping on parsing or execution error_&gt; if any error occurs when parsing test data, importing libraries, and so on.
—skipteardownonexit
Skips teardowns is test execution is prematurely stopped.
—prerunmodifier <name:args>
Activate programmatic modification of test data.
—prerebotmodifier <name:args>
Activate programmatic modification of results.
—randomize <all|suites|tests|none>
Randomizes test execution order.
—console <verbose|dotted|quiet|none>
Console output type.
—dotted Shortcut for –console dotted.
—quiet Shortcut for –console quiet.
-W, —consolewidth <width>
Sets the width of the console output.
-C, —consolecolors <auto|on|ansi|off>
Specifies are colors used on the console.
-K, —consolemarkers <auto|on|off>
Show markers on the console when top level keywords in a test case end.
-P, —pythonpath <path>
Additional locations to add to the module search path.
-E, —escape <what:with>
Escapes characters that are problematic in the console.
-A, —argumentfile <path>
A text file to read more arguments from.
-h, —help Prints usage instructions.
—version Prints the version information.

用于后处理输出的命令行选项

-R, —merge Changes result combining behavior to merging &lt;merging outputs_&gt;_.
—rerunmerge Deprecated since Robot Framework 2.8.6. Use —merge instead.
-N, —name <name>
Sets the name of the top level test suite.
-D, —doc <document>
Sets the documentation of the top-level test suite.
-M, —metadata <name:value>
Sets free metadata for the top-level test suite.
-G, —settag <tag>
Sets the tag(s) to all processed test cases.
-t, —test <name>
Selects the test cases by name.
-s, —suite <name>
Selects the test suites by name.
-i, —include <tag>
Selects the test cases by tag.
-e, —exclude <tag>
Selects the test cases by tag.
-c, —critical <tag>
Tests that have the given tag are considered critical.
-n, —noncritical <tag>
Tests that have the given tag are not critical.
-d, —outputdir <dir>
Defines where to create output files.
-o, —output <file>
Sets the path to the generated output file.
-l, —log <file>
Sets the path to the generated log file.
-r, —report <file>
Sets the path to the generated report file.
-x, —xunit <file>
Sets the path to the generated xUnit compatible result file.
—xunitskipnoncritical
Mark non-critical tests on xUnit compatible result file as skipped.
-T, —timestampoutputs
Adds a timestamp to all output files.
—splitlog Split log file into smaller pieces that open in browser transparently.
—logtitle <title>
Sets a title for the generated test log.
—reporttitle <title>
Sets a title for the generated test report.
—reportbackground <colors>
Sets background colors of the generated report.
-L, —loglevel <level>
Sets the threshold level to select log messages. Optionally the default visible log level can be given separated with a colon (:).
—suitestatlevel <level>
Defines how many levels to show in the Statistics by Suite table in outputs.
—tagstatinclude <tag>
Includes only these tags in the Statistics by Tag table.
—tagstatexclude <tag>
Excludes these tags from the Statistics by Tag table.
—tagstatcombine <tags:title>
Creates combined statistics based on tags.
—tagdoc <pattern:doc>
Adds documentation to the specified tags.
—tagstatlink <pattern:link:title>
Adds external links to the Statistics by Tag table.
—removekeywords <all|passed|name:pattern|tag:pattern|for|wuks>
Removes keyword data from the generated outputs.
—flattenkeywords <for|foritem|name:pattern|tag:pattern>
Flattens keywords in the generated outputs.
—starttime <timestamp>
Sets the starting time of test execution when creating reports.
—endtime <timestamp>
Sets the ending time of test execution when creating reports.
—nostatusrc Sets the return code to zero regardless of failures in test cases. Error codes are returned normally.
—processemptysuite
Processes output files even if files contain empty test suites.
—prerebotmodifier <name:args>
Activate programmatic modification of results.
-C, —consolecolors <auto|on|ansi|off>
Specifies are colors used on the console.
-P, —pythonpath <path>
Additional locations to add to the module search path.
-E, —escape <what:with>
Escapes characters that are problematic in the console.
-A, —argumentfile <path>
A text file to read more arguments from.
-h, —help Prints usage instructions_.
—version Prints the version information.

.. Selects the test suites: Selects the test cases by name.. not critical: considered critical.. Excludes these tags: Includes only these tags.. empty test suites: test suites are empty.. version information: usage instructions.. Flattens keywords: Removes keyword data.. ending time: starting time

Environment variables for execution and post-processing

  • ROBOT_OPTIONS and REBOT_OPTIONS
  • Space separated list of default options to be placedin front of any explicit options__ on the command line.
  • ROBOT_SYSLOG_FILE
  • Path to a syslog_ file where Robot Framework writes internalinformation about parsing test case files and runningtests.
  • ROBOT_SYSLOG_LEVEL
  • Log level to use when writing to the syslog_ file.
  • ROBOT_INTERNAL_TRACES
  • When set to any non-empty value, Robot Framework’sinternal methods are included in error tracebacks__.