junit

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package junit renders engine reports as JUnit XML, the test-report format Jenkins (the junit step), GitLab (artifacts:reports:junit) and Azure Pipelines (PublishTestResults) display. Shared by the CLI's --output junit and the server's /api/v1/gate?format=junit endpoint.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(w io.Writer, r engine.Report, opts Options) error

Write renders the report as JUnit XML: one <testsuite> per finding category, in a fixed order, with one <testcase> per finding (name: its key; classname: upgradescope.<category>), and a not-assessed suite with one test case per capability gap. Outcomes follow the gate in opts, so the test report fails exactly when `scan --fail-on` does:

  • a finding at or above FailOn is a <failure> (type: its severity; message: its title; text: evidence, objects as file:line, fix and references); below it, the test case passes and the same text is its <system-out>;
  • a finding unchanged since the baseline, and a suppressed finding (test case "<key> (suppressed)"), is <skipped> with the reason;
  • a required gap the gate fails on (the target, always; any other unless AllowIncomplete) is an <error>: the verdict is unknown; every other gap is <skipped>, the check not having run.

A report with none of these is one passing test case ("no findings", suite readiness), since Jenkins fails a build whose reports hold no tests. Any gap, even a skipped optional one, adds a not-assessed suite instead, so that case appears only when every check ran: a live scan. A clean files-mode scan is one skipped test per optional check that did not run (deprecated-calls, helm, versions) and none passed. Times are 0. A failed write is returned.

Types

type Options

type Options struct {
	// FailOn is blocker (the default when empty), warning or never.
	FailOn string
	// AllowIncomplete: a required gap other than the target does not fail.
	AllowIncomplete bool
}

Options are the gate the test outcomes follow, as `scan` takes it.

Directories

Path Synopsis
Package junittest reads JUnit XML as CI systems do and validates it against the Jenkins JUnit schema (the xUnit plugin's junit-10.xsd, vendored under testdata), for every package that emits JUnit (the CLI's --output junit and the server's /api/v1/gate?format=junit).
Package junittest reads JUnit XML as CI systems do and validates it against the Jenkins JUnit schema (the xUnit plugin's junit-10.xsd, vendored under testdata), for every package that emits JUnit (the CLI's --output junit and the server's /api/v1/gate?format=junit).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL