in Search

cruizer

aspiring to free and open the mind of .NET developers

JP Hamilton on testing WinForms

JP Hamilton has posted a brief blog post on how he unit tests WinForms. Looks nifty, especially if you use a pattern like Model-View-Presenter for your forms. His rationale is that if you keep on testing only the presenter and mocking out the view in your unit tests, your forms code still gets zero code coverage.

He makes his extension methods available for download in the post. If you're using only VS 2005 or .NET 2.0, it's a simple matter to take out the "this" in the method signatures and just use them as static methods instead of cooler-looking extension methods. It is important to note though that these are especially useful if you use the MVP pattern; otherwise your forms would have functionality that this tool won't be able to test or cover.

Only published comments... May 30 2008, 12:46 PM by cruizer