DEV Community

Discussion on: How would you convince your company to implement unit tests?

Collapse
 
delbetu profile image
M Bellucci

I wonder why people don't implement unit tests?

Our industry made awesome progress when deciding to start writing tests as the standard, but still need to add the DESIGN!
Which for me implies thinking/writing the software as interconnected pieces which play different roles.
At that point, writing isolated tests for those Units should be the norm.

Collapse
 
delbetu profile image
M Bellucci • Edited

Sorry I didn't answer your question.
I would start writing my own unit test.
People will start making comments against them in your PRs
And there you can point them to the literature, or talks around this topic.

A good tip for writing easily isolated tests is:
1- Search in the code for classes which have no dependencies and write a spec for it.
2- If you see a repeated behavior in two different classes Apply the Extract class refactor and create an isolated test for this new class.