Framework Design Guidelines: Testable Frameworks

I thought I do a weekly blog post series that highlights a few of the new additions image[5]_thumb[2]_thumb[2]_thumbto the Framework Design Guidelines 2nd edition.. The first is around writing testable frameworks it is found in Chapter 1: Introduction. Phil brings his real world experience building ASP.NET MVC to the table with this annotation.

PHIL HAACK

I would add one more point to this list, which is that “Well-Designed Frameworks Are Testable.” And by “testable” I don’t just mean that the framework itself can be unit tested, though that is important as well.

One hard lesson we learned from our customers as we released early previews of the ASP.NET MVC framework is that unit test coverage of a framework is not sufficient to calling it “testable.”

While we could easily test our framework, we needed to go further and strive to make sure that applications built using our framework are themselves testable.

This usually falls out naturally by following solid design principles such as Separation of Concerns, Orthogonality, Composition, and DRY (Don’t Repeat Yourself). Most importantly, we put ourselves in our customers’ shoes and built apps using our framework in a test-driven manner. This app building effort improved the design of the Framework immensely.