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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: Twice): How to do proper front-end testing? Is it useful enough to do?

1 点作者 melvinroest将近 5 年前
Hello!<p>I&#x27;m currently in the situation where I&#x27;m noticing that the back-end is tested a fair amount of times, but the front-end does not have any automated tests.<p>So I was wondering: to what <i>extent</i> is UI testing even feasible &#x2F; not a waste of time? What are pragmatic considerations about it? And if it is feasible, how does one go about it?<p>Things I thought about:<p>Is it simply using Selenium or Puppeteer? Is it using a visual diff and checking for that? Is it simply unit testing&#x2F;integration testing?<p>To me, it all seems a bit of a waste unless a front-end process is super critical, like a checkout page.

1 comment

ajeet_dhaliwal将近 5 年前
Back-end tests can be super robust immediately whereas front-end ones generally take some tweaking to get to that point. I still think they’re worth it, especially for testing the core feature happy paths. Selenium and the like are fine. Being end-to-end these type of tests cast a wide net so it’s worth logging the dev tools &#x2F; browser network logs if you can at the time a test fails as well as taking a screenshot.<p>Use a cloud device service like BrowserStack and setup some CI. Who wants to test this stuff manually after the first time. Make sure the front end devs don’t change your data-* attribute tags or whatever else you’re using to find elements and are strict with that.<p>As lead dev and co-founders at Tesults.com I’d obviously recommend you use that for consolidating test reporting from your back-end and front-end tests :-)