Skip to content

pio test should support JUnit XML output for CI/CD pipeline integration #5417

@mahdirajaee

Description

@mahdirajaee

Description

pio test currently only outputs human-readable text to stdout. CI systems (GitHub Actions, GitLab CI, Jenkins, Azure DevOps) all support JUnit XML as the standard format for ingesting test results — enabling per-test annotations on PRs, trend tracking, and failure summaries.

Current Workaround

Users write custom wrapper scripts to parse PlatformIO's text output and convert it to JUnit XML. This is fragile and breaks when output formatting changes between versions.

Proposal

Add a --junit-xml <path> flag to pio test:

pio test --junit-xml results.xml

Output format:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
  <testsuite name="native" tests="12" failures="1" time="3.42">
    <testcase name="test_buffer_overflow" classname="test_memory" time="0.01"/>
    <testcase name="test_null_input" classname="test_memory" time="0.02">
      <failure message="Expected 0 but was -1">src/test_memory.cpp:42</failure>
    </testcase>
  </testsuite>
</testsuites>

Precedent

pio check already supports --json-output, so there is an established pattern for machine-readable output in the CLI. JUnit XML is the de facto standard for test reporting in CI — adoption would be immediate.

Context

The long-standing request for better CI integration (#882, #4883) reinforces that automated pipeline usage is a major segment of the user base.

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