Is it possible to get code coverage information in a way that does not assume you can see color?

257 views
Skip to first unread message

jared.s...@gmail.com

unread,
Jan 9, 2020, 10:39:41 AM1/9/20
to golang-nuts

I'm a totally blind developer who is trying to learn go. When running

go tool cover -html=cover.out -o cover.html

It appears the HTML generated uses color to show the lines of code that are not covered without any other way of identifying uncovered lines. This is obviously an issue if your totally blind. Are there any alternative tools that can take a coverage profile and give a text representation of lines that are not covered?

 

Sam Whited

unread,
Jan 9, 2020, 10:59:11 AM1/9/20
to golan...@googlegroups.com
On Thu, Jan 9, 2020, at 08:50, jared.s...@gmail.com wrote:
> I'm a totally blind developer who is trying to learn go. When running
>
> go tool cover -html=cover.out -o cover.html
>
> It appears the HTML generated uses color to show the lines of code
> that are not covered without any other way of identifying
> uncovered lines.

The title text of lines that are covered is "1" and the title text of
lines that are not covered is "0". This isn't ideal, but maybe you could
feed the HTML through a program that would rewrite this to something
visible to your screen reader or other device?

—Sam

--
Sam Whited

David Chase

unread,
Jan 10, 2020, 12:51:30 PM1/10/20
to golang-nuts
Lack of accessibility is a legitimate bug.
Would would be good for you?
For example, is there something in html that would work?

I have no idea what current screen readers do -- would underlining, or bolding, or italics?
(I used the three styles for the three words in the line just above.)

Jared Stofflett

unread,
Jan 10, 2020, 4:47:28 PM1/10/20
to golang-nuts

I use Jaws as my screen reader and as far as I can tell there's no way to automatically announce underlining, italics, or bolding in HTML. I'd use the region role for all uncovered code. See

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Region_role

I'm not an accessibility expert though. I know Google has a bunch of people working on web accessibility who could help provide guidance. You could try contacting the Google presenters who present at the CSUN accessibility conference. See

https://www.csun.edu/cod/conference/sessions/index.php/public/conf_sessions/

for a session list. It looks like Google has a large presence at this conference.

andrew....@elastic.co

unread,
Jan 11, 2020, 1:41:01 AM1/11/20
to golang-nuts
A long time ago I wrote a tool that will annotate source code with coverage, generating plain text output. Lines that are not covered will be annotated with "MISS". I don't know how well this will work for you, but you could give it a try. You can find it here: https://github.com/axw/gocov

You can annotate the source of the package in your current working directory by running "gocov test | gocov annotate -". The hyphen at the end is necessary to read from stdin.

Hope this helps.

Cheers,
Andrew

Fazlul Shahriar

unread,
Jan 12, 2020, 1:19:59 AM1/12/20
to golang-nuts
I also wrote a tool like that: https://github.com/fhs/golinecov
It displays coverage report from 'go test' without any color or fancy HTML.
I wrote it because I wanted something text oriented that I can view within my editor.
Hope it's useful.

fhs

drc...@google.com

unread,
Jan 21, 2020, 4:33:00 PM1/21/20
to golang-nuts
I reopened an old bug for this, and perhaps it will get some attention.

drc...@google.com

unread,
Jan 22, 2020, 12:24:37 PM1/22/20
to golang-nuts
Different, new bug instead: https://github.com/golang/go/issues/36685
Reply all
Reply to author
Forward
0 new messages