RobotFramework框架系列 – 运行参数篇

2024-06-21 13:08

本文主要是介绍RobotFramework框架系列 – 运行参数篇,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

我们前文说了,RF有很强大的参数运行

rebot –help 可以得到如下的Option,我把常用的黄色标注,当然大家可以根据实际使用中进行选择

Options

=======

 

-R --merge When combining results, merge outputs together

instead of putting them under a new top level suite.

Example: rebot --merge orig.xml rerun.xml

-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.

-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/).

-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

-G --settag tag * Sets given tag(s) to all executed test cases.

-t --test name * Select test cases 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.

 支持通配符 比如 “--test Example* ”就是以Example的case名称全部被选中

-s --suite name * Select test suites 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. Given name can be a simple

pattern similarly as with --test.

-i --include tag * Select test cases to 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*

-e --exclude tag * Select test cases not to be included by tag. These

tests are not selected even if included with

--include. Tags are matched using the rules explained

with --include.

--processemptysuite Processes output 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.

-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.

-n --noncritical tag * Tests with given tag are not critical even if they

have a tag set with --critical. Tag can be a pattern.

-d --outputdir dir Where to create output files. The default is the

directory where Rebot is run from and the given path

is considered relative to that unless it is absolute.

-o --output file XML output file. Not created unless this option is

specified. Given path, similarly as paths given to

--log, --report and --xunit, is relative to

--outputdir unless given as an absolute path.

-l --log file HTML log file. Can be disabled by giving a special

name `NONE`. Default: log.html

Examples: `--log mylog.html`, `-l none`

-r --report file HTML report file. Can be disabled with `NONE`

similarly as --log. Default: report.html

-x --xunit file xUnit compatible result file. Not created unless this

option is specified.

--xunitskipnoncritical Mark non-critical tests on xUnit output as skipped.

-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`.

--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.

--reporttitle title Title for the generated test report. The default

title is `<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

-L --loglevel level Threshold for selecting messages. Available levels:

TRACE (default), DEBUG, INFO, WARN, NONE (no msgs).

Use syntax `LOGLEVEL:DEFAULT` to define the default

visible log level in log files.

Examples: --loglevel DEBUG

--loglevel DEBUG:INFO

--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.

--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

--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

--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

--removekeywords all|passed|for|wuks|name:<pattern>|tag:<pattern> *

Remove keyword data from all generated outputs.

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*

--flattenkeywords for|foritem|name:<pattern>|tag:<pattern> *

Flattens matching keywords in all generated outputs.

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>`

--starttime timestamp Set starting time of test execution when creating

reports. Timestamp must be given in format

`2007-10-01 15:12:42.268` where all separators are

optional (e.g. `20071001151242268` is ok too) and

parts from milliseconds to hours can be omitted if

they are zero (e.g. `2007-10-01`). This can be used

to override starttime of the suite when reports are

created from a single suite or to set starttime for

combined suite, which is otherwise set to `N/A`.

--endtime timestamp Same as --starttime but for ending time. If both

options are used, elapsed time of the suite is

calculated based on them. For combined suites,

it is otherwise calculated by adding elapsed times

of combined test suites together.

--nostatusrc Sets the return code to zero regardless of failures

in test cases. Error codes are returned normally.

--prerebotmodifier class * Class to programmatically modify the result

model before creating outputs.

-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.

-P --pythonpath path * Additional locations to add to the module search path

that is used when importing Python based extensions.

-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

-A --argumentfile path * Text file to read more arguments from. 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/

-h -? --help Print usage instructions.

--version Print version information.

这篇关于RobotFramework框架系列 – 运行参数篇的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1081314

相关文章

MySQL中时区参数time_zone解读

《MySQL中时区参数time_zone解读》MySQL时区参数time_zone用于控制系统函数和字段的DEFAULTCURRENT_TIMESTAMP属性,修改时区可能会影响timestamp类型... 目录前言1.时区参数影响2.如何设置3.字段类型选择总结前言mysql 时区参数 time_zon

Python如何使用seleniumwire接管Chrome查看控制台中参数

《Python如何使用seleniumwire接管Chrome查看控制台中参数》文章介绍了如何使用Python的seleniumwire库来接管Chrome浏览器,并通过控制台查看接口参数,本文给大家... 1、cmd打开控制台,启动谷歌并制定端口号,找不到文件的加环境变量chrome.exe --rem

Linux中Curl参数详解实践应用

《Linux中Curl参数详解实践应用》在现代网络开发和运维工作中,curl命令是一个不可或缺的工具,它是一个利用URL语法在命令行下工作的文件传输工具,支持多种协议,如HTTP、HTTPS、FTP等... 目录引言一、基础请求参数1. -X 或 --request2. -d 或 --data3. -H 或

Linux使用nohup命令在后台运行脚本

《Linux使用nohup命令在后台运行脚本》在Linux或类Unix系统中,后台运行脚本是一项非常实用的技能,尤其适用于需要长时间运行的任务或服务,本文我们来看看如何使用nohup命令在后台... 目录nohup 命令简介基本用法输出重定向& 符号的作用后台进程的特点注意事项实际应用场景长时间运行的任务服

如何在一台服务器上使用docker运行kafka集群

《如何在一台服务器上使用docker运行kafka集群》文章详细介绍了如何在一台服务器上使用Docker运行Kafka集群,包括拉取镜像、创建网络、启动Kafka容器、检查运行状态、编写启动和关闭脚本... 目录1.拉取镜像2.创建集群之间通信的网络3.将zookeeper加入到网络中4.启动kafka集群

详解Spring Boot接收参数的19种方式

《详解SpringBoot接收参数的19种方式》SpringBoot提供了多种注解来接收不同类型的参数,本文给大家介绍SpringBoot接收参数的19种方式,感兴趣的朋友跟随小编一起看看吧... 目录SpringBoot接受参数相关@PathVariable注解@RequestHeader注解@Reque

Java向kettle8.0传递参数的方式总结

《Java向kettle8.0传递参数的方式总结》介绍了如何在Kettle中传递参数到转换和作业中,包括设置全局properties、使用TransMeta和JobMeta的parameterValu... 目录1.传递参数到转换中2.传递参数到作业中总结1.传递参数到转换中1.1. 通过设置Trans的

java如何调用kettle设置变量和参数

《java如何调用kettle设置变量和参数》文章简要介绍了如何在Java中调用Kettle,并重点讨论了变量和参数的区别,以及在Java代码中如何正确设置和使用这些变量,避免覆盖Kettle中已设置... 目录Java调用kettle设置变量和参数java代码中变量会覆盖kettle里面设置的变量总结ja

spring 参数校验Validation示例详解

《spring参数校验Validation示例详解》Spring提供了Validation工具类来实现对客户端传来的请求参数的有效校验,本文给大家介绍spring参数校验Validation示例详... 目录前言一、Validation常见的校验注解二、Validation的简单应用三、分组校验四、自定义校

SpringBoot中Get请求和POST请求接收参数示例详解

《SpringBoot中Get请求和POST请求接收参数示例详解》文章详细介绍了SpringBoot中Get请求和POST请求的参数接收方式,包括方法形参接收参数、实体类接收参数、HttpServle... 目录1、Get请求1.1 方法形参接收参数 这种方式一般适用参数比较少的情况,并且前后端参数名称必须