TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Generating unit tests in Go

39 pointsby jyzover 9 years ago

5 comments

andrewguentherover 9 years ago
This is a really poor demo.<p>I opened up the demo page and generated the tests. On first glance, I see a bunch of tests that just verify that the given code does exactly what it was written to do. That misses the _entire_ point of tests. Oh, and only a single test case for each function.<p>Looking a bit more closely, the test cases wouldn&#x27;t even pass. They&#x27;re just filled with placeholder values. Okay, fine, the boilerplate is generated, but you have to fill in the expected returns.<p>What about mocks? Why can I only have one test case per function? Also, None of these test cases are documented. You&#x27;re really still writing the bulk of the tests yourself anyway.<p>I&#x27;m not saying there is no value here, but if there is value, that demo shows none of it.
评论 #10814921 未加载
评论 #10814880 未加载
Zikesover 9 years ago
This would be great if it were implemented as a &quot;go generate&quot; compatible script or executable. [1]<p>[1] <a href="https:&#x2F;&#x2F;blog.golang.org&#x2F;generate" rel="nofollow">https:&#x2F;&#x2F;blog.golang.org&#x2F;generate</a>
twicover 9 years ago
I assumed this was a joke about how bad some unit tests are. Then i thought it might be a satire on unit tests, from someone who really thinks they&#x27;re pointless.<p>Then i realised that this is a demo of a company that someone actually wants to make their fortune with:<p><a href="http:&#x2F;&#x2F;magictests.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;magictests.com&#x2F;</a><p><a href="https:&#x2F;&#x2F;angel.co&#x2F;magictests" rel="nofollow">https:&#x2F;&#x2F;angel.co&#x2F;magictests</a>
mholtover 9 years ago
500 Internal Server Errors out the wazoo; e.g. <a href="http:&#x2F;&#x2F;magictests.com&#x2F;static&#x2F;js&#x2F;bootstrap.min.js" rel="nofollow">http:&#x2F;&#x2F;magictests.com&#x2F;static&#x2F;js&#x2F;bootstrap.min.js</a>
donatjover 9 years ago
For some reason pasting code into it in chrome on Mac, it gets completely mussed up.