3 ms·
For E2E testing, is the browser still totally necessary? I feel the React rendering test libraries (React Testing Library/Enzyme) manage quite well? I have used
by hogFeast 6y ago
For E2E testing, is the browser still totally necessary? I feel the React rendering test libraries (React Testing Library/Enzyme) manage quite well? I have used Selenium and that ilk before but find you get odd failures every now and then (i.e. browser problems but also resources problems when you run parallel tests).
Also, I am sure this will be pointed out several times, but snapshot testing doesn't seem like a great idea. Your test is wrapped totally around your implementation and it is kind of unclear what you are testing i.e. change something, run test, snapshot fails because of UI update, update snapshot, passes...if you introduce some kind of unexpected bug with that change, how do you know? It works if you are testing for the same result but if you are making changes to the snapshot, you lose all coverage...tests are just as important then too.
Tbf, you usually end up wrapped around your implementation anyway (i.e. checking to see if there is a button that has certain text) but I feel that snapshots are a bit shortcut-y and give false confidence.
Surely the point of UI tests is to really test the functionality from the point of view of the user...I don't think snapshots achieve this (and I have always got in trouble when I strayed away from this principle...personally).
- yen223 6y agoTests are a trade - you spend some dev time writing and maintaining tests, and in return you might save some time and money down the line, if the test prevents bugs from doing damage. Tests aren't always good. There are tests that are so difficult to write and maintain, that they basically never repay their dev cost. All that is to say, I like snapshot tests. Snapshot tests can be created and updated automatically, basically making their dev cost close to 0. They are so cheap that they don't actually have to catch a lot of bugs for them to be a net positive.