DEV Community

Discussion on: I'm a veteran UI developer, AMA!

Collapse
 
hawicaesar profile image
HawiCaesar

Hey Rob, I've seen your answer on TDD and unit tests...

If you were to write tests for the frontend...what tests would you write unit tests (testing state changes, implementation details) or tests that emulate how the user uses software ?

Collapse
 
kendalmintcode profile image
Rob Kendal {{☕}} • Edited

I think the best approach is to blend both with a leaning towards emulating how the user interacts with the thing you’re testing.

We largely cover four areas when testing:

  • do certain elements show/hide on the front end (e.g. how the user interacts with the app)
  • certain internal changes, state, functions are fired
  • API calls being made
  • the interactivity between components.

Oh and we’re also looking to build out a suite of visual regression testing. This approach physically interacts with the app/site/whatever and then matches screenshots to see if there have been negative/unexpected changes