【问题标题】:Cucumber test report from Rakefile来自 Rakefile 的黄瓜测试报告
【发布时间】:2019-09-17 17:50:30
【问题描述】:

我有一组 Ruby/Cucumber 测试。在 IDE 中运行时,所有测试都能成功运行。

当我使用此 CLI 命令执行测试时,测试会运行并生成测试报告。

$ cucumber --format progress --format html --out=features_report.html -r features --tags '@this or @that' features

我需要从 Rakefile 执行测试才能并行运行测试。我可以使用rake local 调用下面的 Rakefile 来运行它们


desc 'Run the functional test suite locally'
  task :local do

test_args = ["-n", '1', 
             "-o" "-t '@this or @that'",
             "--type", 
             "cucumber", 
             '--',
             '-f',
             'progress', 
             '--',
             'features',]

    ParallelTests::CLI.new.run(test_args)
  end

但我不知道生成测试报告的额外选项/参数在哪里。

如果我在 Rakefile 中对报告位进行分组,就像它们在工作 CLI 命令中一样

             'progress',
              '-f',
              'HTML', 
             '--out',
             'first.html',

我收到此错误:

Error creating formatter: HTML (LoadError)

或者,如果我这样做"-o" "-t '@this or @that' --out first.html --format HTML",

我明白了:

All but one formatter must use --out, only one can print to each stream (or STDOUT) (RuntimeError)

生成测试报告的参数在 test_args 中的什么位置,它们是什么样的?

提前致谢。

【问题讨论】:

    标签: ruby cucumber rakefile test-reporting


    【解决方案1】:

    您可以在cucumber.yml 文件中创建profile 并在配置文件下传递参数,如下所示。

    default:
      --no-source --no-color
      --format progress --format html --out=features_report.html
    

    现在按原样运行您的 rake 任务,cucumber 将从 cucumber.yml 文件中选择参数并生成报告。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-17
      • 1970-01-01
      • 1970-01-01
      • 2022-01-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多