The covercmp command displays code coverage changes between unit tests. This plugin is heavily inspired by benchcmp
This tool is the first piece I needed in a larger project to support free code coverage in CI/CD especially because companies are looking to cut costs due to COVID-19
To measure the coverage impact of a change, use 'go test' to run coverage before and after the change:
go test -count=1 -cover > before.txt
# make changes
go test -count=1 -cover > after.txt
Then feed the coverage results to covercmp:
covercmp go before.txt after.txt
Covercmp will summarize and display the coverage changes, in a format like this:
package before cov after cov delta
compress/bzip2 87.5% 97.5% 10.0%
compress/flate 82.7% 93.8% 11.1%
compress/gzip 89.9% 89.9% 0.0%
compress/lzw 87.2% 87.2% 0.0%
compress/zlib 84.7% 84.7% 0.0%
- Download the latest binary for your OS release from the releases page
- Rename the file to
covercmp
- Make the file executable (
chmod +x covercmp
) - Checkout the help menu for usage instructions
covercmp help
- (Optional Step) Move it to a folder in your PATH variable. (
mv covercmp /bin
)
- Golang
- TBD
- Pull requests are welcome
- The API is open enough to support other Languages. See Golang driver implementation for more details