Skip to content

JUnit files are appended to with RSpec formatters #40

@bobbytables

Description

@bobbytables

Hello, found an interesting case while using this gem.

I'm trying to add JUnit formatter to use the results in Jenkins using the junit instruction. When using queue mode with this gem (and service) however, Knapsack might run rspec tests multiple times from the same process. This is causes a problem because --out in RSpec appends to a file. So that means you end up with a file that has something along the lines of:

<xml ...>
<testcase stuff in here />
<xml> # next suite run starts and appends...

Jenkins (and from what I can see, XML parsers in general) don't like when there are multiple <xml> tags in the file, as you can see from this error:

Failed to read test report file /workspace/HCM_PR-7675-355EZNVL3NLOS25MQ7X2QIWUKL7VGXOWVAWXENJHPGTJ4IJEY4FA@5/tmp/rspec_results7c4385c84.xml
org.dom4j.DocumentException: Error on line 2175 of document file:///workspace/HCM_PR-7675-355EZNVL3NLOS25MQ7X2QIWUKL7VGXOWVAWXENJHPGTJ4IJEY4FA@5/tmp/rspec_results7c4385c84.xml : The processing instruction target matching "[xX][mM][lL]" is not allowed.

The more important piece is this:

The processing instruction target matching "[xX][mM][lL]" is not allowed.

Detail on the error is in this stackoverflow: http://stackoverflow.com/questions/19889132/error-the-processing-instruction-target-matching-xxmmll-is-not-allowed

I can see an "after hook" of sorts be helpful here because we could just rename the file afterwards to something that won't be appended to and Jenkins can read the multiple files just fine.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions