|
|
Subscribe / Log in / New account

Testing in Go: philosophy and tools

Testing in Go: philosophy and tools

Posted May 26, 2020 19:19 UTC (Tue) by benhoyt (subscriber, #138463)
In reply to: Testing in Go: philosophy and tools by Cyberax
Parent article: Testing in Go: philosophy and tools

Interesting. I'd love to know more about this; any links? Our team at work has recently started running integration tests using the regular testing package and it seems to work well, but these are fairly lightweight "PostgreSQL database only" integration tests, not "run all the services" integration tests.


to post comments

Testing in Go: philosophy and tools

Posted May 26, 2020 22:33 UTC (Tue) by phlogistonjohn (subscriber, #81085) [Link]

Here's an example of wrapping the main function in a test to get coverage.

I have to second Cyberax's comment. Last time I looked into this it quickly became too complicated to deal with, and I didn't need it very much and gave up. I too peeked at the code to implement this and it was too complex for me to follow (having been doing Go mostly full time for a year or so).

It's rather unfortunate that this isn't a feature of the compiler and say a helper module you can import into your own main. I lean heavily normal on the coverage feature for tests in a few of the projects I work on. I would love to have a simple, noninvasive way to generate coverage from any binary.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds