Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create combined coverage report for unit and integration tests #510

Open
shaheerkootteeri opened this issue Mar 17, 2023 · 0 comments
Open
Labels
enhancement New feature or request needs-triage

Comments

@shaheerkootteeri
Copy link
Contributor

shaheerkootteeri commented Mar 17, 2023

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.

@shaheerkootteeri shaheerkootteeri added enhancement New feature or request needs-triage labels Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-triage
Projects
None yet
Development

No branches or pull requests

1 participant