views:

67

answers:

4

I'm new to C#4 and WPF and I'm about to start a new application.

Coming from a C++/MFC world, I'm interested in testing strategies used with up to date technologies.

From instance :

  • Unit Testing
  • Functionnal testing
  • UI Testing
  • other?

Any advices would be appreciated.

Thanks

+1  A: 

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.

Larry Smithmier
this is more system testing then unit testing
Ian Ringrose
correct, I opted to try and answer what I considered to be the hardest to test/least tested area in most projects. Your answer about the Unit Testing is spot on. MVVM is a good addition.
Larry Smithmier
A: 

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 tries 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

akjoshi
A: 

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.

Ian Ringrose