Hacker News new | comments | show | ask | jobs | submit login
Go Testing Toolbox: from Autotest to Vagrant (nathany.com)
36 points by nathany 1515 days ago | hide | past | web | 5 comments | favorite



We improved our Go support on Codeship (https://codeship.io, I am one of the founders) over the last couple of days. Give it a try and if you have questions let me know.


So testing double(mocking) in Go is still a big headache in version 1.2?


    So testing double(mocking) in Go is still a big headache 
    in version 1.2?
I'm confused by your meaning. Mocking hasn't ever been a headache in Go. You just tease apart your functional components by using interfaces, and then test at the boundaries with mock implementations.


Someone on the Go Nuts mailing list asked for an example of mocking with interfaces, so I quickly wrote up this:

http://play.golang.org/p/9JUvbeBTAY


Mocking is always a problem if the code wasn't written with testing in mind, regardless of the language.

Dynamic languages, make such cases a bit less painful, because you can go in and override the code.

Static languages with bytecode generation also allow for some workarounds, with help of frameworks that rewrite bytecode.

With generated native code, things get really ungly when trying to rewrite the generated machine code.

So in the end, things are way much simpler if the code allows for testing.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: