3 ms·
Ask HN: Twice): How to do proper front-end testing? Is it useful enough to do?
Hello!
I'm currently in the situation where I'm noticing that the back-end is tested a fair amount of times, but the front-end does not have any automated tests.
So I was wondering: to what extent is UI testing even feasible / not a waste of time? What are pragmatic considerations about it? And if it is feasible, how does one go about it?
Things I thought about:
Is it simply using Selenium or Puppeteer? Is it using a visual diff and checking for that? Is it simply unit testing/integration testing?
To me, it all seems a bit of a waste unless a front-end process is super critical, like a checkout page.
- ajeet_dhaliwal 6y agoBack-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 / browser network logs if you can at the time a test fails as well as taking a screenshot. 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. 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 :-)