Skip to content

JUnit: write the stdout and stderr channels to <system-out> and <system-err> #335

Description

@roxblnfk

JUnitWriter does not emit <system-out> / <system-err> at all. A test's MessageLog is dropped from the JUnit report, even though the format has a place for exactly this output.

Proposal

Map the two process-stream channels of Messenger onto the JUnit elements, per <testcase>:

  • Messenger::CHANNEL_STDOUT -> <system-out>
  • Messenger::CHANNEL_STDERR -> <system-err>

Both are plain text elements (CDATA, no attributes), one of each per testcase. Messages of a channel are concatenated in recorded order. A testcase with no messages in a channel gets no element.

Other channels (output, plugin channels) are not written: JUnit has no slot for them, and the terminal renderer already shows them.

Why

Anything a test or a plugin reports as stderr should reach CI. The first consumer is the error-handler plugin (#73, #262): captured PHP errors of a passing test are logged to the stderr channel, so they show up in Jenkins / GitLab / TeamCity test details without inventing a non-standard <warning> element.

Notes

  • Status::Risky and failures keep their <error> / <failure> encoding; this is additive.
  • Suite-level <system-out> / <system-err> are out of scope.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions