bitfield / gotestdox

A tool for formatting Go test results as readable documentation
https://bitfieldconsulting.com/golang/test-names
MIT License
114 stars 4 forks source link

Format for direct publication #14

Open Jumziey opened 1 year ago

Jumziey commented 1 year ago

When thinking about the use case for gotestdox as something that can do part of the documentation, have there been any thought about changing the output format to be something like markdown? That would enable easy publication of the results for stakeholders etc. to keep track of what a software suite supports.

bitfield commented 1 year ago

Well, that sounds like a good idea, but I'm not sure we need to do anything special for gotestdox output to be usable in Markdown documents. This comment is formatted in Markdown, and I've pasted some output in directly:

github.com/bitfield/shift: ✔ BlockSize returns block size (0.00s) ✔ Decrypt (0.00s) ✔ Decrypt 010203040506 - 0101010101010101010101010101010101010101010101010101010101010101 = 000102030405 (0.00s) ✔ Decrypter crypt blocks (0.00s) ✔ Encrypt (0.00s) ✔ Encrypt 000102030405 + 0101010101010101010101010101010101010101010101010101010101010101 = 010203040506 (0.00s) ✔ Encrypter enciphers block aligned message (0.00s) ✔ NewCipher gives err key size for invalid key (0.00s) ✔ NewCipher gives no error for valid key (0.00s) ✔ Pad (0.00s) ✔ Pad 1 short of full block (0.00s) ✔ Pad 2 short of full block (0.00s) ✔ Pad 3 short of full block (0.00s) ✔ Pad empty block (0.00s) ✔ Pad full block (0.00s) ✔ Unpad (0.00s) ✔ Unpad 1 short of full block (0.00s) ✔ Unpad 2 short of full block (0.00s) ✔ Unpad 3 short of full block (0.00s) ✔ Unpad empty block (0.00s) ✔ Unpad full block (0.00s)

It looks fine! What other formatting would you suggest?

Jumziey commented 1 year ago

Looks pretty good, especially in a terminal. And I must agree I was a bit unclear :see_no_evil:. Lets put the text you pasted into dillinger (online markdown editor) and it looks like this: image

What I was thinking was to use some more of the refinement you can use with a doc format such as markdown (not married to markdown though) to make it closer whats described for agiledox. A simple example could be to simply add each package as a sub header and perhaps some collective information as the last output in package like

## github.com/bitfield/shift:
 ✔ BlockSize returns block size (0.00s)
 ✔ Crack (0.01s)
 ✔ Decrypt (0.00s)
 ✔ Decrypt 010203040506 - 0101010101010101010101010101010101010101010101010101010101010101 = 000102030405 (0.00s)
 ✔ Decrypter crypt blocks (0.00s)
 ✔ Encrypt (0.00s)
 ✔ Encrypt 000102030405 + 0101010101010101010101010101010101010101010101010101010101010101 = 010203040506 (0.00s)
 ✔ Encrypter enciphers block aligned message (0.00s)
 ✔ NewCipher gives err key size for invalid key (0.00s)
 ✔ NewCipher gives no error for valid key (0.00s)
 ✔ Pad (0.00s)
 ✔ Pad 1 short of full block (0.00s)
 ✔ Pad 2 short of full block (0.00s)
 ✔ Pad 3 short of full block (0.00s)
 ✔ Pad empty block (0.00s)
 ✔ Pad full block (0.00s)
 ✔ Unpad (0.00s)
 ✔ Unpad 1 short of full block (0.00s)
 ✔ Unpad 2 short of full block (0.00s)
 ✔ Unpad 3 short of full block (0.00s)
 ✔ Unpad empty block (0.00s)
 ✔ Unpad full block (0.00s)
 **Test coverage xx%**

That would be parsed in Dillinger like image

Should also note that I'm just using Dillinger to make it easy to test for anyone checking this out, but the general formatting is pretty similar across tools.

afbjorklund commented 1 year ago

It is possible to use go-test-report, to generate HTML documents and to generate markdown (with a PR)

https://github.com/vakenbolt/go-test-report