在Jruby 9.1.7.0中运行黄瓜脚本。输出转到STDOUT。如何将其保存到本地变量?
require 'cucumber'
require 'stringio'
@output = StringIO.new
features = 'features/first.feature'
args = features.split.concat %w(-f html)
# Run cucumber
begin
# output goes to STDOUT
Cucumber::Cli::Main.new(args).execute!
rescue SystemExit
puts "Cucumber calls @kernel.exit(), killing your script unless you rescue"
end
答案 0 :(得分:0)
如果您输入cmd “cucumber --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.
您可以使用
修改代码args = features.split.concat %w(-f html -o test.html)