A while back I talked about how testable code helps manage complexity . In that post, I mentioned one common rebuttal to certain design decisions made in code in order to make it more testable. Why would I want to do XYZ just do improve testability? Recently, I heard one variation of this comment in the comments to my post on unit test boundaries . Several people suggested that itââ?¬â?¢s fine to have unit tests access the database, after all, the code relies on data from the database, it should be tested. Implicit in this statement is the question, ââ?¬Å? Why would I want to abstract away the data access just to improve testability? ââ?¬Â Keep in mind, I never said you shouldnââ?¬â?¢t test your codeââ?¬â?¢s interaction with the database. You absolutely should. I merely...(read more) ...
Go to the complete details ...