Skip to content

AlekSi/gocov-xml

Repository files navigation

gocov XML

A tool to generate Go coverage in XML report for using with tools/plugins like Jenkins/Cobertura.

Table of Contents

This is a simple helper tool for generating XML output in Cobertura format for CIs like Jenkins, vsts and others from github.com/axw/gocov output. The generated XML output is in the latest coverage-04.dtd schema

Installation

Just type the following to install the program and its dependencies:

For Go 1.17 and above:

go install github.com/axw/gocov/gocov@latest
go install github.com/AlekSi/gocov-xml@latest

For previous Go versions:

go get github.com/axw/gocov/...
go get github.com/AlekSi/gocov-xml

Usage

NOTE: gocov-xml reads data from the standard input.

gocov [-source <absolute path to source>]

Where,

  • source: Absolute path to source. Defaults to the current working directory.

Examples

Generate coverage by passing gocov output as input to gocov-xml

gocov test github.com/gorilla/mux | gocov-xml > coverage.xml

Specifying optional source

gocov test github.com/gorilla/mux | gocov-xml -source /abs/path/to/source > coverage.xml

Authors