DEV Community

Discussion on: The Dev.to-Community's Opinion about Unit-Tests

Collapse
 
leightondarkins profile image
Leighton Darkins

This is an awesome summary of what was a great discussion. Thanks for sharing!

Your description of the relationship between SOLID and TDD is super valid. Test-driving new code (or refactors to old code) is usually my first activity when working with a client who I know is struggling with issues that stem from poor application of SOLID principles.

On the UI components breaking visually, I wouldn't call that a concern for unit tests or even traditional snapshots but rather Visual Regression Tests. There are a bunch of libraries out there, like BackstopJS, that make this reasonable easy to do. There's also a PR here that outlines how to do visual regressions with jest using jest-image-snapshot.

Overall, I wouldn't feel ignorant or dumb for not being completely sold on the value of unit testing. Skepticism is healthy and I'd be much more worried about the person who just accepts that unit tests are good for them without thoroughly examining the landscape first.

Collapse
 
kayis profile image
K

Haha, case of the unknown unknown :D

I knew I wanted something like "Visual Regression Tests" but I didn't know how they were called so I couldn't search for it.

I found Storybook and Loki which seem very promising and work for React & React-Native.

Thank you very much :)