C# - WPF : testing strategies C# - WPF : testing strategies wpf wpf

C# - WPF : testing strategies


As Larry said White UI test framework can be used for UI testing WPF. This post explains this in more detail -

Testing WPF applications with the White UI Test framework: http://blogs.msdn.com/b/john_daddamio/archive/2008/04/04/testing-wpf-applications-with-the-white-ui-test-framework.aspx

Also have look at this article to know how to automate the UI testing:

Automating UI Tests In WPF Applications: http://msdn.microsoft.com/en-us/magazine/dd483216.aspx

Xaml team has come up with a XAML Compliance Suite to verify XAML(I haven't tried it myself though) -

http://blogs.msdn.com/b/llobo/archive/2010/07/07/xaml-compliance-suite-v1.aspx

Various third-party tools are also available for testing WPF application, like this one from AutomatedQA -

AutomatedQA’s TestComplete is a comprehensive automated testing tool that helps QA teams automate their functional, unit, regression and other testing types for a wide variety of application types, including Windows Presentation Foundation (WPF) applications.

http://www.automatedqa.com/products/testcomplete/testing-wpf-apps/

I would also suggest you to go through WPF Application Quality Guide from MS

This document provides an overview of testing Windows Presentation Foundation (WPF) applications and controls.

http://windowsclient.net/wpf/white-papers/wpf-app-quality-guide.aspx#intro


Take a look at White. From their site:

White Automate windows applications https://white-project.googlecode.com/svn/

White is a framework for automating rich client applications based on Win32, WinForms, WPF, Silverlight and SWT (Java) platforms. It is .NET based and does not require the use of any proprietary scripting languages. Tests/automation programs using White can be written with whatever .NET language, IDE and tools you are already using. White provides a consistent object-oriented API, hiding the complexity of Microsoft's UIAutomation library (on which White is based) and windows messages. Only stable versions of White are released, so all releases are production-ready.


These days most people that care about unit testing of WPF tend to make use of the MODEL-VIEW-VIEWMODEL (MVVM) design pattern. This is a tag on stackoverflow about it.

This lets you unit-test most of your code (including a lot of the UI logic) without WPF getting in the way.

For system testing see the other answers to this questions.