Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

feat: add JUnit XML output format and --output-file flag for CI/CD test reporting

Offen
#386 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
55/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Ruhig
Tech-Stack
go
Bereich
cli, testing

Rechercherichtung

Beginne in cmd/test.go und prüfe das pkg/output Formatter-Interface aus #371, bevor du die Integrationspunkte auswählst. Definiere die JUnit-Strukturen in pkg/output mit Go's encoding/xml, unterstütze --output-file für die Formatter-Ausgabe und verifiziere, dass das standardmäßige stdout-Verhalten unverändert bleibt, während JSON- und JUnit-Dateien die erwarteten Ergebnisse enthalten.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Context:
Maintainer @Harsh4902 raised in #301: "can we store this output at a particular location for further usage?" — this issue directly addresses that question.

CI/CD platforms natively consume JUnit XML for test reporting:

  • GitHub Actions: renders test results in PR summaries via junit-reporter
  • Jenkins: JUnit plugin reads XML natively, no extra config
  • GitLab CI: artifacts: reports: junit: picks it up automatically
  • CircleCI: store_test_results uses JUnit XML

Currently microcks test only outputs to stdout. There is no way to :

  1. Write results to a file for artifact upload or downstream tooling
  2. Produce JUnit XML that CI dashboards can render natively

This forces teams to parse text output with fragile regex, defeating the purpose of structured CI integration.

Description :
Two additive features, cleanly separated :

  1. --output-file=<path> flag
    Write test results to a file instead of (or in addition to) stdout.
    Enables GitHub Actions artifact uploads, local file caching, and script pipelines without output redirection hacks.
microcks test ... --output json --output-file results.json
microcks test ... --output junit --output-file results.xml
  1. junit output format
    A new format value for the --output flag (building on #371's pkg/output Formatter interface) :

Non-breaking: both flags are opt-in. Default behavior (text to stdout) unchanged.
Builds on #371: reuses the pkg/output Formatter interface — JUnit is just another Formatter implementation.

Implementation ideas:

  1. Add --output-file= to cmd/test.go — open the file, pass an io.Writer to the formatter :

var out io.Writer = os.Stdout
if outputFile != "" {
f, err := os.Create(outputFile)
if err != nil { ... }
defer f.Close()
out = f
}

  1. Add JUnitFormatter to pkg/output/ implementing the Formatter interface from #371:

type JUnitFormatter struct{}

func (f *JUnitFormatter) Format(result *TestResult, w io.Writer) error {
// marshal to encoding/xml JUnit structs
}

  1. JUnit XML structs (stdlib encoding/xml — zero new dependencies) :

type JUnitTestSuites struct {
XMLName xml.Name xml:"testsuites"
Suites []JUnitTestSuite xml:"testsuite"
}
type JUnitTestSuite struct {
Name string xml:"name,attr"
Tests int xml:"tests,attr"
Failures int xml:"failures,attr"
Cases []JUnitTestCase xml:"testcase"
}

no new dependencies — uses only stdlib encoding/xml.

happy to implement once the pkg/output foundation from #371 lands.

Vorherrschende Sprache
Go
Sterne
58
Forks
72
Ø Merge
1 T. 7 Std.
Gemergte PRs (30 T.)
22

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus microcks/microcks-cli

Alle Issues in microcks/microcks-cli

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.