Skip to content

Create combined coverage report for unit and integration tests #510

@shaheerkootteeri

Description

@shaheerkootteeri

Description of problem

Go 1.20 support generating combined coverage report for integration tests as well as unit test cases. This will enable a better view of test coverage on the code.

Proposed solution

<Please describe your proposed solution, preferably in the following style:>

Apps-cli can benefit from the new feature of GO 1.20 to collect coverage profile on integration tests to produce more accurate information on the code coverage. If we can combine both unit as well as integration reports as well.

Example

<Code snippets that illustrate the when/then blocks>

Beginning in Go 1.20, Go supports collection of coverage profiles from applications and from integration tests, larger and more complex tests for Go programs. To build an application for collecting coverage profiles, pass the -cover flag when invoking go build on your application binary target.
Binaries built with “-cover” write out profile data files at the end of their execution to a directory specified via the environment variable GOCOVERDIR. Example:

$ go build -cover -o myprogram.exe myprogram.go
$ mkdir somedata
$ GOCOVERDIR=somedata ./myprogram.exe

Go 1.20 introduces a new tool, ‘covdata’, that can be used to read and manipulate coverage data files from a GOCOVERDIR directory.

To report a “percent statements covered” metric for each instrumented package, use the command “go tool covdata percent -i=”.

More details on the code coverage can be found here.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions