DEV Community

Discussion on: Writing 'Testable' Code Feels Wrong

Collapse
 
alekseiberezkin profile image
Aleksei Berezkin

Not all of the code needs to be unit-tested IMO. Good test is when the code is complex but the test is easy. Perfect candidates — algorithms, utils, libs etc. Bad candidates: getters and setters, DTO, and boilerplate business logic.

Automated integration tests are a completely different story, but there is also a room for frustration. For example, Selenium tests usually locate controls by tags or classes; and when a UI is changed, tests may break. However not having tests is also dangerous.

So, it seems there can't be strict rule unfortunately. There must be, well, ”reasonable” amount of tests, and the measure of “reason” is very vague.