gotestyourself / gotestsum

'go test' runner with output optimized for humans, JUnit XML for CI integration, and a summary of the test results.
Apache License 2.0
2.07k stars 122 forks source link

Add testdox format #359

Closed bitfield closed 1 year ago

bitfield commented 1 year ago

This format shows test names as full sentences, which is useful both for autogenerating documentation ("dox"), and for encouraging programmers to write their test names as sentences describing the behaviour of the unit under test.

The specific method of formatting test names as sentences is that used by https://github.com/bitfield/gotestdox.

bitfield commented 1 year ago

I pushed a commit to use the same icons we use in other formats. There's a --format-hivis option to change the icons to more colorful ones. In a future version we might look at making those the default.

I leave that up to you, of course. But you might be interested to know why gotestdox uses the emojis it does. One of my first users was a blind developer who uses a screen reader, and he reported that the ✘ emoji I was using is pronounced by the screen reader as something like "heavy ballot x", which is weird (gotestsum's is pronounced "heavy multiplication x", which is even weirder). Changing it to simply x made the output a lot more accessible for him.

dnephin commented 1 year ago

Ah, I had not considered screen readers but that's a great point! I'd love to provide some better support. Maybe --format-audible or something like that could change the x to "failed test", etc? The pattern here for switching between the original icons and the new hivis icons seems like it would make it easy to switch to other options as well.

Thank you for explaining the design decisions in gotestdox!

afbjorklund commented 1 year ago

I added --format-icons text, which outputs "PASS" for ✓, "SKIP" for ∅ and "FAIL" for ✖

https://github.com/gotestyourself/gotestsum/pull/366#issuecomment-1699759852