Testing GUI's is hard, and isn't always worth the extreme effort. By separating the pure GUI from the guts of the application, you can easily add and test business features without involving the GUI.
这是我从Pragmatic Unit Testing in C# with NUnit中摘出来的一句话。我觉得很好。因为上一个项目中,我是写界面的。我花了很多时间来寻找用单元测试来测试GUI的办法,最终没有什么收效。但其实问题根本就不是我作为写GUI的人没有做好测试,而是在GUI中放了太多的东西。要让GUI没有问题的最好办法,不是对GUI做测试,而是让GUI尽可能的只和GUI有关,那样出的一切问题都是在表面上的,而不是私底下的。