HTML Coverage Reports with GoConvey

February 18, 2014
Tags

You asked for it and now you've got it.

For packages that pass all tests, coverage reports are generated and made available by clicking the package name, which in that case becomes a link (provided you've cleared your browser's cache!).

Click the package name

Right now the coverage command that is run is something like this:

$ go test -covermode=set -coverprofile=<package_name>.txt

That command generates a plain text profile used in the following command:

$ go tool cover -html=<package_name>.txt -o <packge_name>.html

...which plunks down an html file which we can link to from the UI.

As you can see above, we use the 'set' covermode as it is more suited for concurrent scenarios and is the cheapest report to generate (thanks to Rob Pike for the advice on that one). We might support other values there if it's wanted (a phrase which here means comment below if you have strong feelings).

Here's what a bit of the report looks like (gradient of grey through green means covered, red means not covered):

Thanks to the go team for the go cover tool!

The coverage profiles and html files are stored at:

$GOPATH/src/github.com/smartystreets/goconvey/web/client/reports

Out of the way but available to you if you have plans for them. There's lots you can do with coverage in GoLang. Happy testing!

PS - Brand new shiny UI coming soon to GoConvey... (as if it wasn't good enough already!)

Subscribe to our blog!
Learn more about RSS feeds here.
Subscribe Now
Get our latest eBook!
Evaluating a geocoding tool?
Get the buyer's guide
smarty logo
Download now
Read our recent posts
Rising Parcel Shipping Costs in 2022: How to Cut Your Shipping Expenses
Arrow Icon
Parcel shipping costs have been rising since 2020. We’ve all seen inflation on the consumer end, whether we’re checking out online or paying at the gas pump. And skyrocketing freight rates have made headlines. Today, we’re going to focus on the impact of the increasing cost of shipping on your business and what you can do about it. But don’t lose hope—while we’re going to explore climbing shipment costs in this article, we’ll also chat about what your business can do to make shipping more efficient.
How to Clean Address Data For the Holiday Rush
Arrow Icon
It’s November, and online shopping is ramping up to its climactic end-of-year blitz. www. blackfriday. com estimates that between Thanksgiving and Black Friday of this year, consumers will spend approximately $13 billion 1. That’s great news for your business. But if you don’t have the right tools in place to help you meet that demand, you might be left wishing you had better prepare. Staffing may be one issue for many businesses. According to the US Chamber of Commerce, the wholesale and retail trade industry has experienced the second-highest quit rate of all industries since November 20202.
Helpful Hints to Authenticating Your APIs
Arrow Icon
We brought out the big guns in the way of our Development Team Lead, Kent Gividen, in a webinar all about authenticating your APIs. He went over some of his most useful tips and tricks that he uses to ensure APIs are authenticated. Was it helpful? You betcha. You wanna get the sparknotes? Read on. Common and Not-So-Common APIs to Know About Kent began by outlining the APIs that he has run into the most in his years as a developer. Some of them he dug into a little deeper than others, but these are all useful to be aware of.

The leader in location data intelligence

Ready to get started?