tags:

views:

865

answers:

3

Can I use TDD for gui application? How to do it.

+2  A: 

Why not. Here is a good article, from object mentor.

Found another blog post, TDD - Introduction to Moq. Its related to C# and VB.NET.

Checking out Myth and Misconception regarding TDD is a must.

Here is a book related to .NET, TDD in Microsoft .NET.

Adeel Ansari
+1  A: 

Chad Myers has a nice walk through testing the controller:

http://www.chadmyers.com/Blog/archive/2007/11/27/tdd-with-asp.net-mvc-3.5-extensions.aspx

Leah
+2  A: 

The answer which has evolved over the last few years is, you don't apply TDD to the GUI, you design the GUI in such as way that there's a layer just underneath you can develop with TDD. The Gui is reduced to a trivial mapping of controls to the ViewModel, often with framework bindings, and so is ignored for TDD.

This is known variously as the Presentation Model (Fowler) the Model-View-ViewModel and DataModel-View-ViewModel architecture. There are already a number of good discussions on StackOverflow.

This approach removes the GUI layer from TDD and unit testing. It does not mean the GUI is never tested but just acknowledges that it is not cost effective to pursue automated GUI testing, particularly as part of TDD. Integration and user testing should cover the GUI.

Andy Dent