HACKER Q&A
📣 airocker

How should we unit test web UI? Do mocks ever work?


How should we unit test web UI? Do mocks ever work?


  👤 Jugurtha Accepted Answer ✓
We used Selenium and we were able to catch a lot of regressions in the application. These are not "unit tests".

Here's a talk by Brandon Rhodes titled "Using Python to power Selenium at scale": https://www.youtube.com/watch?v=z1aUuqKg_gA

We'd have a deployment, and then launch a Selenium script to test the UI: login page load, registering a user, creating resources from the application, displaying elements, input text to validate, etc.

This is coupled with a lot of input validation, and a lot of actual unit tests for functions. We also decoupled functionality into pure functions.


👤 2rsf
what is the goal of your testing?