¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: How would you TDD a website front-end?


 

I¡¯ve struggled a bit with this in 2019.? I think George is right.?

With React and with Angular, it seems that a lot of the ¡°code¡± is css and html and some declarative bits here and there. Many microtests around those things feels like ¡°testing the compiler¡± and so they¡¯re not very interesting. Mocking the back-end feels wrong too.?

So it may be good to ensure that crucial bits of the JSON request are built correctly or that lookups of urls are done, and such, but for the most part i think the logic behind needs to be tested and only rather interesting bits of the front end (decision-making functions, separated from document-model manipulation stuff).?

I have seen a lot of testing done on these UI bits, but not to good effect. It was always more like something a person done and had made it work rather than something that worked for the developers. Often the tests got in the way of refactoring instead of supporting it.

So... yeah. I don¡¯t have answers, but what George says sounds right.?

Tim

I would test the business logic of the model/web service.
I would also have a few tests that make sure the view is wired correctly
to the model/web service. Not many of these.
I might also have tests that provide model data to the view and make
verifications that it handles them correctly. This can be hard.

? - George
--
Peace,
Tim
-------------------------------------


Join [email protected] to automatically receive all group messages.