Reputation: 1025
I'd like to shift my code to a more test driven development model, but am unsure the best way to do this for the presentation layer.
Other layers behave like a black box where you can give input and expect output.
The presentation layer is not so simple. Are there any programs, guides, or practices to help with test driven xaml development.
Upvotes: 3
Views: 4649
Reputation: 136593
Well I cannot refrain from posting an answer. The approach shown in the accepted answer is a maintenance-trap to say the least.
Move your GUI development to the MVP / MVVM model. WPF is MVVM friendly. Make thin GUIs (with minimal code/logic) that delegate/sync with a Presenter class. This means that you can write unit tests against the presenter and test a significant portion of your code without the UI. Write only a handful of UI tests and perform the majority of your functional testing using the presenter class.
Writing UI tests isn't the answer (for non-trivial GUIs) because they are
Upvotes: 13
Reputation: 19897
Here is something from microsoft on the topic. For further information, see the link in the comments. http://msdn.microsoft.com/en-us/magazine/dd483216.aspx
Upvotes: 4