Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dustinspecker/go-combined-unit-integration-coverage-demo
https://github.com/dustinspecker/go-combined-unit-integration-coverage-demo
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dustinspecker/go-combined-unit-integration-coverage-demo
- Owner: dustinspecker
- License: mit
- Created: 2023-01-04T23:40:42.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-05T13:59:38.000Z (almost 2 years ago)
- Last Synced: 2024-06-21T18:53:07.911Z (5 months ago)
- Language: Go
- Homepage: https://dustinspecker.com/posts/go-combined-unit-integration-code-coverage/
- Size: 2.93 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# combined-coverage-demo
> Demonstrate combining code coverage from unit tests and integrations into a single profile.
## Purpose
[Go 1.20](https://go.dev/testing/coverage/) adds support for collecting code coverage during integration tests by creating binaries ready to collect coverage.
This [demo](get-cover.sh) shows the following:
1. Collecting code coverage for unit tests in binary format instead of traditional text format
1. Building a binary ready to collect coverage
1. Executing the binary in a successful manner
1. Executing the binary in a manner that will take a failure path
1. Showing the coverage from unit tests alone
1. Showing the coverage from integration tests alone
1. Showing the combined coverage of unit tests and integration tests
1. Converting binary coverage report to text format
1. Displaying the combined coverage using the text formatSteps using the binary coverage report using `go tool covdata`, while steps
consuming the text format use `go tool cover`. Both of these can be seen in [get-cover.sh](get-cover.sh).## Usage
1. Install Go 1.20 RC2 or newer
1. Run `./get-cover.sh`