0

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

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

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

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


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 中的什么位置,它们是什么样的?

提前致谢。

4

1 回答 1

0

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

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

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

于 2019-09-18T03:17:32.967 回答