和很多命令行工具一样,可以通过’cucumber -hep'来查看命令行选项。这里我们只列举一些常用的选项。
(1). 支持的自然语言:
$ cucumber —il8n LANG 列举特殊语言的关键字。
$ cucumber --i18n help 列举所有语言。
例如:汉语:cucumber —il8n zh-CN。
输出格式:
$ cucumber -f FORMAT
$ cucumber --format FORMAT
FORMAT (默认为pretty):
debug: For developing formatters - prints the calls made to the listeners.
html: Generates a nice looking HTML report.
json: Prints the feature as JSON
json_pretty: Prints the feature as prettified JSON
junit: Generates a report similar to Ant+JUnit.
pretty: Prints the feature as is - in colours.
progress: Prints one character per scenario.
rerun: Prints failing files with line numbers.
stepdefs:Prints All step definitions with their locations (steps are not printed).
usage: Prints where step definitions are used.
例如:cucumber -f pretty:
(2). 将输出保存在文档里:
$ cucumber -o [FILE|DIR]
$ cucumber --out [FILE|DIR]
(3). 执行相关命令:
只执行用Tag标记的特殊features或scenarios
$ cucumber -t TAG_EXPRESSION
$ cucumber --tags TAG_EXPRESSION
例如:$ cucumber --tags @tag1
执行指定名称的feature elements:
$ cucumber -n NAME
$ cucumber --name NAME
不执行指定格式的features文件或ruby文件:
$ cucumber -e PATTERN
$ cucumber --exclude PATTERN
显示执行格式但不执行steps:
$ cucumber -d
$ cucumber --dry-run
例如 :cucumber --dry-run
跳过pending的step:
$ cucumber -i
$ cucumber --no-snippets
$ cucumber -q
$ cucumber —quiet
执行指定到行:
$ cucumber features/XXXXX.feature —line LINE_NUM
不在执行结束时打印所用的时间:
$ cucumber --no-duration
(4). 显示版本信息命令:
$ cucumber --version
(5). 生成Cucumber Project文件目录结构命令:
$ cucumber --init 初始化并生成常规的Cucumber Project文件目录结构
(6). 帮助命令:
$ cucumber -h
$ cucu —help