rspec_junit_formatter not working

I installed rspec_junit_formatter gem as prompted by the message in my builds but Circle still reports that it cannot collect metadata. I’m using rspec. Does anyone have a similar problem?

1 Like

I don’t know ruby. so I’m not 100% sure where this goes, but I believe you have to also call it, something like this in your Rakefile:

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |t|
  t.fail_on_error = false
  t.rspec_opts = "--no-drb -r rspec_junit_formatter --format RspecJunitFormatter -o $CIRCLE_TEST_REPORTS/junit.xml"
end

Ref: http://stackoverflow.com/a/10684219/335583

Does the Artifacts tab show the presence of the XML files with the test results? If it does, can you post one of the XML files here?

1 Like

Thank you, this solved my problem! Changed my circleci.yml to the following

test:
  override:
    - RAILS_ENV=test bundle exec rspec -r rspec_junit_formatter --format RspecJunitFormatter -o $CIRCLE_TEST_REPORTS/rspec/junit.xml

Would be cool if this was included in official documentation.

3 Likes

I’m also seeing this…

  • We have a .rspec that looks like:
--profile
--color
--format documentation
  • rspec_junit_formatter is installed, 0.2.3, in both test and development groups
  • Test step is not overriden
  • …and then the command that gets run under the “Parallel RSpec” section is:
bundle exec rspec 'bunch of spec files....' --format progress

…and afterwards the fails aren’t collected - they also don’t show up in the artifacts.

The Test Summary says “Help us provide better insight around your tests and failures. Set up your test runner to output in JUnit-style XML, so we can:”

Doing this results in all 16 containers running all the tests!