TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: What is the most impressive test suite youve ever worked with

3 点作者 escot6 天前
Did it have near 100% coverage or did it make tradeoffs on what to test?<p>Did it include UI tests which are notoriously difficult, and if so how did it handle issues like timeouts and the async nature of UI?<p>Did it have rigid separation of concepts between unit vs integration tests etc, or more fluid?<p>Could you refactor internal code without changing tests — the holy grail.

2 条评论

MoreQARespect6 天前
The test suite was 90% &quot;end to end&quot; unit tests - no real infrastructure was used it was all faked. Only interactions with the outside world (web client, LLM, database) were tested and all interactions were faked.<p>(This is not feasible on every project but it was on this one, database interactions were simple)<p>There were a small number (~5%) of slow tests that used a real LLM, database, infrastructure, etc. and a small number of very low level unit tests (~5%) surrounding only complex stateless functions with simple interfaces.<p>Refactoring could be done trivially without changing any test code 98% of the time.<p>Additionally, the (YAML) tests could rewrite their expected responses based upon the actual outcome - e.g. when you added a new property to a rest api response you just reran the test in update mode and eyeballed the test.<p>There was also a template used to generate how-to markdown docs from the YAML.<p>Test coverage was probably 100% but I never measured it. All new features being written with TDD&#x2F;documentation driven development probably guaranteed it.
评论 #44031682 未加载
tsm6 天前
I&#x27;ve found the Metabase test suite[0] to be very good considering it&#x27;s real-world software written by a for-profit company. Coverage is good, the correct tests usually break when doing a refactor (stuff like &quot;Oh, I thought this change was harmless but actually it breaks the permissions model&quot;), etcetera. But the most important thing is that there&#x27;s a strong team culture of a) demanding good tests on each PR b) hunting down flaky tests and other sources of friction.<p>Another neat thing was that there used to be a full-time SDET who spent a lot of time writing Cypress reproductions for known bugs. When you picked up the bug, you could un-skip the test that was right there waiting for you.<p>All that said, of course it&#x27;s far from perfect!<p>0: <a href="https:&#x2F;&#x2F;github.com&#x2F;metabase&#x2F;metabase&#x2F;">https:&#x2F;&#x2F;github.com&#x2F;metabase&#x2F;metabase&#x2F;</a> Backend unit tests are in test&#x2F;, Frontend unit tests are in frontend&#x2F;test, end-to-end tests (Cypress) are in e2e.