如何将黄瓜测试结果保存到文件 [英] How to save Cucumber test results to a file

查看:111
本文介绍了如何将黄瓜测试结果保存到文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些黄瓜测试可以通过控制台运行,

I have some Cucumber tests that can be run from console with

rake cucumber

是否存在用于将测试结果存储到文本文件的命令行选项?

Is there a command line option to store test results to a text file?

推荐答案

要么


  • 运行黄瓜直接使用 -o 。来自黄瓜--help

-o, --out [FILE|DIR]
    Write output to a file/directory instead of STDOUT. This option
    applies to the previously specified --format, or the
    default format if no format is specified. Check the specific
    formatter's docs to see whether to pass a file or a dir.


  • 运行 Rake c $ c> CUCUMBER_OPTS =-o whatfile ,即

  • Run rake with CUCUMBER_OPTS="-o whateverfile", i.e.

    CUCUMBER_OPTS="-o whateverfile" rake cucumber # assuming you're using a Bourne family shell
    

    rake CUCUMBER_OPTS="-o whateverfile" cucumber
    


  • 编辑lib / tasks / cucumber.rake并添加

  • Edit lib/tasks/cucumber.rake and add

    t.cucumber_ops = '-o whateverfile'
    

    一个或多个 Cucumber :: Rake :: Task s

    或者直接自己重定向黄瓜命令的输出:

    Or just redirect the output of the cucumber command yourself:

    cucumber > whateverfile
    


  • -o 与重定向稍有不同:始终将进度输出打印到屏幕上。如果您未指定格式,则会在文件中放入默认的漂亮格式。如果这样做(例如黄瓜-f html -o whatfile ),它将把您指定的格式放入文件中。

    -o is a little different than redirecting: it always prints the "progress" output to the screen. If you don't specify a format it puts the default "pretty" format in the file. If you do (e.g. cucumber -f html -o whateverfile) it puts the format you specify in the file.

    如果有问题,我正在使用Ruby Cucumber 2.3.2。

    In case it matters, I'm using Ruby Cucumber 2.3.2.

    这篇关于如何将黄瓜测试结果保存到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆