Code coverage for Go integration tests

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • datastation

    App to easily query, script, and visualize data from every database, file, and API.

  • There was a technique that existed already where you could use `go test -cover` and the `-o` flag to produce a binary from `go test` rather than actually running tests. So you could build a binary that had coverage enabled. Then when you ran

    Here's an example: https://github.com/multiprocessio/datastation/blob/main/runn....

    I can't remember where I found this technique but it's been around for a while.

    This new option is the same thing but a way to `go build` with `-cover` instead of `go test -cover -o $out`? Do I have that right?

  • rust-coverage-integration-test

    end-to-end integration-test tool for rust that supports local/hosted coverage

  • A bit more convoluted, but it's also possible in Rust

    https://github.com/pldubouilh/rust-coverage-integration-test

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • go-internal

    Selected Go-internal packages factored out from the standard library

  • No idea if the technique was original, it’s been too long, but I wrote about it on the Cloudflare blog in 2016. https://blog.cloudflare.com/go-coverage-with-external-tests/

    Anyway, very happy to see the team ship first class support for it. It immediately made coverage support in testscript much more natural, too. https://github.com/rogpeppe/go-internal/pull/201

  • limgo

    Simple tool to ensure the test coverage does not fall below a limit

  • A colleague of mine wrote a tool to make this process a bit simpler: https://github.com/gotesttools/limgo

  • go

    The Go programming language

  • It is (non-sarcastically) good to see the Go team changing their opinion on the usefulness of it: https://github.com/golang/go/issues/16537

  • goc

    A Comprehensive Coverage Testing System for The Go Programming Language

  • A few years ago, I used goc to collect coverage from multiple services at the same time when they were used in E2E tests. I was very happy with it. Check it out!

    https://github.com/qiniu/goc

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts