DEV Community

Discussion on: How to write unit tests

Collapse
 
marcinwosinek profile image
Marcin Wosinek

For learning unit tests I would try doing radical TDD for few weeks. Radical, as in not writing a single line of code, unless you have a test that fails when the line is not there. It will be weird at first - you will spend more time thinking about writing tests than about writing code. But pretty fast you will develop a sense of what is easy to test and what is not

Collapse
 
jeremyf profile image
Jeremy Friesen

I did that for a brief stint, and it really helped me develop that sense you mention.