Add support for adding file attachments in junit report format #4666
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Soon, gitlab will add ability to show images attached in junit report file on merge request/pipeline view:
This was also possible in jenkins, with junit-attachments plugins and supported by some libraries like mocha:
The format is a bit weird, because it's simply supposed to be added to
system-out
element, example from gitlab:Example use-case for phpunit would be with library like
symfony/panther
: it already has option to make screenshots on failed assertions, but for now they are not linked in any way in the report: symfony/panther#392It is possible to achieve that simply by
echo
ing the attachment during the phpunit test, but I find this way flawed: it interferes with tests that have to check stdout and with--disallow-test-output
option, it also pollutes job output in CI, and has to be done in the test itself or intearDown
.I submit a proposition for basic interface that could be implemented by TestCases to attach files to junit report. For now it would only be used by junit format, since I'm not aware of other formats requiring such feature.
I think it's simple enough, and doesn't introduce any BC, WDYT?