by nmfisher · 5y ago · 0 comments
It sounds like you and I share a similar methodology. I don’t write unit tests for all my code. In fact if I had to guess, I’d say I generally test less than 25%.
But I do write all my code such that it’s capable of having unit tests written for it.
In many codebases that’s just not possible. The developers have spent all their time writing and none of their time thinking. It’s one big yarn ball that’s impossible to write unit tests for. For these people, forcing them to write tests up front would have resulted in a much cleaner code base.
I completely agree that it's not always necessary, but I definitely find it a useful tool.
That being said, TDD with ML applications is a bunch trickier, as you'll normally have functions/classes which take an unfathomably looooooonnnnngggg time to run.
Chances are that your code base will be untestable, at least for unit testing, if unit testing where not considered at all when writing it.