【问题标题】:How to generate cucumber report name with a timestamp?如何生成带有时间戳的黄瓜报告名称?
【发布时间】:2014-12-01 08:44:58
【问题描述】:

我有一个每天运行黄瓜功能的工具,但问题是报告总是与以前的名称相同,并且昨天的报告可以被当前的覆盖。 我的 cucumber.yml 看起来像这样:

...
default-report: FIG_NEWTON_FILE=default.yml --color --format html --out results/report.html
...

我有一个想法,即在挂钩中重命名以前生成的报告并将它们移动到某个存档文件夹,但对于这么小的东西来说,这看起来有点复杂。有没有一种方法可以生成带有时间戳的黄瓜报告名称,而不是在 cucumber.yml 中对其进行硬编码?

【问题讨论】:

    标签: cucumber


    【解决方案1】:

    cucumber.yml 文件经过 ERb 预处理。所以你可以使用 ruby​​ 代码在 cucumber.yml 文件中生成你喜欢的值。

    要在报告文件名中添加时间戳,您可以执行以下操作:

    default-report: FIG_NEWTON_FILE=default.yml --color --format html --out results/<%= Time.now.strftime("%Y%m%d-%H%M%S") %>-report.html
    

    【讨论】:

    • 谁能建议如何在 Java 中做同样的事情?
    猜你喜欢
    • 2018-07-18
    • 2018-11-25
    • 2022-01-27
    • 2021-04-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-26
    • 1970-01-01
    相关资源
    最近更新 更多