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.

Building a testable Go web app

93 pointsby rgarciaover 10 years ago

3 comments

tkinomover 10 years ago
I personally actually prefer your testv0 method. The way I understood it is a full stack testing that requires putting data into the DB and query them back.<p>What&#x27;s wrong with that? It might be just a bit slower but for me that kind test is a lot of comprehensive. I have in the past has to slightly change the DB schema. Because of full stack test coverage were in place, full functional tests make all the bugs caused by schema change visible immediately.<p>For me, schema changes in DB cause some other operations to the DB failure is much difficult to detected and fixed if the issue is not visible to the developer immediately.<p>It might be slower (~a few minutes for ~300 full funtional test scripts run directly from the web-browser side) instead of seconds in your case, but I think the time is well spend for how quickly complex issues can be discovered and fixed.<p>BTW, I keep track of all DB operations (sql query) time as part of the json response. If they are &gt; 1 milliseconds (SSD HD), I will flags them as potential issue in bugs DB for future investigation for SQL optimization.<p>It should be easy to add the SQL query response time to a performance DB to track and change over time&#x2F;sw version.
评论 #8413850 未加载
评论 #8413719 未加载
评论 #8413704 未加载
评论 #8413682 未加载
spacemanmattover 10 years ago
I didn&#x27;t see any schema tests for the db. Testing the DAO is its own concern, and I can&#x27;t consider that as unit test coverage for the schema portion of the project. I would normally be looking to something like PgTAP here.<p>(For the &quot;oh really?&quot; crowd, here&#x27;s a brief rundown on what I often test: object permissions&#x2F;owners, function correctness, non-trivial constraints, triggers (usually existence testing, sometimes functional verification), application-global data. And yes, it is great to have all that nailed down before diving into writing a DAO)
crolekover 10 years ago
They switched from angular to essentially a static site for SEO reasons. I wonder if they&#x27;re batch generating the static pages or making them dynamically on request.
评论 #8413872 未加载
评论 #8413894 未加载