简体   繁体   English

RSPEC结果仅附加到1个文件

[英]RSPEC results appended to just 1 file

Whenever I run several Spec files, it overwrites the previous results file. 每当我运行几个Spec文件时,它都会覆盖以前的结果文件。 How can I run several spec files with the results appended to just 1 file. 我如何运行几个规格文件,并将结果附加到仅一个文件中。 I have the following configuration: 我有以下配置:

require 'etc'
require 'yarjuf'

RSpec.configure do |config|
  config.color=true
  config.add_formatter(:documentation)
  config.add_formatter(JUnit,"./results/rspec_results.xml")
end

And I just call the specfiles as: 我将specfile称为:

$ bundle exec rspec basic1_spec.rb
$ bundle exec rspec basic2_spec.rb

I need to have the results of both basic1 and basic2 in the same file 'rspec_results.xml' 我需要在同一文件“ rspec_results.xml”中同时包含basic1和basic2的结果

NOTE: I don't want to do "bundle exec rspec *spec.rb" => since I run the spec files individually sometimes. 注意:我不想执行“ bundle exec rspec * spec.rb” =>,因为有时我会分别运行规格文件。 Thanks. 谢谢。

您可以将多个文件名传递给rspec

$ bundle exec rspec basic1_spec.rb basic2_spec.rb

You could try also with: 您也可以尝试:

$ bundle exec rspec basic1_spec.rb >> file.xml
$ bundle exec rspec basic2_spec.rb >> file.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM